示例#1
0
void RestoreInitialVolumes()
{
    OBSSetDesktopVolume(config.GetFloat(TEXT("General"), TEXT("PrevDesktopVolume")), true);

    OBSSetMicVolume(config.GetFloat(TEXT("General"), TEXT("PrevMicVolume")), true);

    if(config.GetInt(TEXT("General"), TEXT("PrevDesktopMuted")) == 1)
        OBSToggleDesktopMute();

    if(config.GetInt(TEXT("General"), TEXT("PrevMicMuted")) ==1)
        OBSToggleMicMute();
}
示例#2
0
BOOL Material::LoadFromFile(CTSTR lpFile)
{
    traceIn(Material::LoadFromFile);

    String path;

    ConfigFile materialFile;
    if(!materialFile.Open(lpFile))
    {
        AppWarning(TEXT("Couldn't load material file '%s'"), lpFile);
        return FALSE;
    }

    effect = ::GetEffect(materialFile.GetString(TEXT("Material"), TEXT("Effect")));

    if(!effect)
    {
        AppWarning(TEXT("Invalid effect in material file '%s'"), lpFile);
        return FALSE;
    }

    String soundName = materialFile.GetString(TEXT("Material"), TEXT("SoftSound"));
    if(soundName.IsValid()) SetSoftHitSound(soundName);
    soundName = materialFile.GetString(TEXT("Material"), TEXT("HardSound"));
    if(soundName.IsValid()) SetHardHitSound(soundName);

    restitution = materialFile.GetFloat(TEXT("Material"), TEXT("Restitution"));
    friction    = materialFile.GetFloat(TEXT("Material"), TEXT("Friction"), 0.5f);

    DWORD curParamID = 0;

    HANDLE hCurParam;
    while(hCurParam = effect->GetParameter(curParamID++))
    {
        EffectParameterInfo paramInfo;
        effect->GetEffectParameterInfo(hCurParam, paramInfo);

        if(paramInfo.propertyType != EffectProperty_None)
        {
            if(paramInfo.propertyType == EffectProperty_Texture)
            {
                MaterialParameter *param = Params.CreateNew();
                param->type = Parameter_Texture;
                param->handle = hCurParam;
                *(BaseTexture**)param->data = GetTexture(materialFile.GetString(TEXT("Parameters"), paramInfo.name));
            }
            else if(paramInfo.propertyType == EffectProperty_Color)
            {
                MaterialParameter *param = Params.CreateNew();
                param->type = Parameter_Vector3;
                param->handle = hCurParam;
                Vect chi = materialFile.GetColor3(TEXT("Parameters"), paramInfo.name);
                mcpy(param->data, &chi, sizeof(Vect));
            }
            else if(paramInfo.propertyType == EffectProperty_Float)
            {
                MaterialParameter *param = Params.CreateNew();
                param->type = Parameter_Float;
                param->handle = hCurParam;
                *(float*)param->data = materialFile.GetFloat(TEXT("Parameters"), paramInfo.name)*paramInfo.fMul;
            }
        }
    }

    return TRUE;

    traceOut;
}