void OnSceneSwitch(CTSTR scene) { XElement *sceneElement; float desktopVolumeLevel, micVolumeLevel; int dMFV, mMFV; bool desktopMuted, micMuted; if(!bPSVEnabled) return; sceneElement = OBSGetSceneElement(); if(sceneElement) { desktopVolumeLevel = sceneElement->GetFloat(TEXT("psvDesktopVolume"), 1.0f); micVolumeLevel = sceneElement->GetFloat(TEXT("psvMicVolume"), 1.0f); dMFV = sceneElement->GetInt(TEXT("psvDesktopMFV")); mMFV = sceneElement->GetInt(TEXT("psvMicMFV")); desktopMuted = (dMFV & PSV_VOL_MUTED) == PSV_VOL_MUTED; micMuted = (mMFV & PSV_VOL_MUTED) == PSV_VOL_MUTED; OBSSetDesktopVolume(desktopVolumeLevel, true); if(desktopMuted) OBSToggleDesktopMute(); OBSSetMicVolume(micVolumeLevel, true); if(micMuted) OBSToggleMicMute(); } }
void UpdateSettings() { for(UINT i=0; i<bitmapImages.Num(); i++) delete bitmapImages[i]; bitmapImages.Clear(); //------------------------------------ bool bFirst = true; StringList bitmapList; data->GetStringList(TEXT("bitmap"), bitmapList); for(UINT i=0; i<bitmapList.Num(); i++) { String &strBitmap = bitmapList[i]; if(strBitmap.IsEmpty()) { AppWarning(TEXT("BitmapTransitionSource::UpdateSettings: Empty path")); continue; } BitmapImage *bitmapImage = new BitmapImage; bitmapImage->SetPath(strBitmap); bitmapImage->EnableFileMonitor(false); bitmapImage->Init(); if(bFirst) { fullSize = bitmapImage->GetSize(); baseAspect = double(fullSize.x)/double(fullSize.y); bFirst = false; } bitmapImages << bitmapImage; } //------------------------------------ transitionTime = data->GetFloat(TEXT("transitionTime")); if(transitionTime < MIN_TRANSITION_TIME) transitionTime = MIN_TRANSITION_TIME; else if(transitionTime > MAX_TRANSITION_TIME) transitionTime = MAX_TRANSITION_TIME; //------------------------------------ bFadeInOnly = data->GetInt(TEXT("fadeInOnly"), 1) != 0; bDisableFading = data->GetInt(TEXT("disableFading")) != 0; bRandomize = data->GetInt(TEXT("randomize")) != 0; //------------------------------------ curTransitionTime = 0.0f; curTexture = 0; if(bRandomize) { srand( (unsigned)time( NULL ) ); if(bitmapImages.Num() > 1) { curTexture = lrand(bitmapImages.Num()); while((nextTexture = lrand(bitmapImages.Num())) == curTexture); } } else nextTexture = (curTexture == bitmapImages.Num()-1) ? 0 : curTexture+1; bTransitioning = false; curFadeValue = 0.0f; }
void UpdateSettings() { for(UINT i=0; i<textures.Num(); i++) delete textures[i]; textures.Clear(); //------------------------------------ bool bFirst = true; StringList bitmapList; data->GetStringList(TEXT("bitmap"), bitmapList); for(UINT i=0; i<bitmapList.Num(); i++) { String &strBitmap = bitmapList[i]; if(strBitmap.IsEmpty()) { AppWarning(TEXT("BitmapTransitionSource::UpdateSettings: Empty path")); continue; } Texture *texture = GS->CreateTextureFromFile(strBitmap, TRUE); if(!texture) { AppWarning(TEXT("BitmapTransitionSource::UpdateSettings: could not create texture '%s'"), strBitmap.Array()); continue; } if(bFirst) { fullSize.x = float(texture->Width()); fullSize.y = float(texture->Height()); baseAspect = double(fullSize.x)/double(fullSize.y); bFirst = false; } textures << texture; } if(textures.Num() == 0) CreateErrorTexture(); //------------------------------------ transitionTime = data->GetFloat(TEXT("transitionTime")); if(transitionTime < MIN_TRANSITION_TIME) transitionTime = MIN_TRANSITION_TIME; else if(transitionTime > MAX_TRANSITION_TIME) transitionTime = MAX_TRANSITION_TIME; //------------------------------------ bFadeInOnly = data->GetInt(TEXT("fadeInOnly")) != 0; bDisableFading = data->GetInt(TEXT("disableFading")) != 0; bRandomize = data->GetInt(TEXT("randomize")) != 0; //------------------------------------ curTransitionTime = 0.0f; curTexture = 0; if(bRandomize) { srand( (unsigned)time( NULL ) ); if(textures.Num() > 1) { curTexture = lrand(textures.Num()); while((nextTexture = lrand(textures.Num())) == curTexture); } } else nextTexture = (curTexture == textures.Num()-1) ? 0 : curTexture+1; bTransitioning = false; curFadeValue = 0.0f; }