diff options
author | Paul Gilbert | 2011-08-01 22:36:21 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-08-01 22:36:21 +1000 |
commit | 8f70ee9afc877b22123269669d155e710a467c4b (patch) | |
tree | 6a5cfc1754122a797f5d127c373238e0e08e2f31 | |
parent | 10033ca976feabf365c9378f4156724d76fe64c5 (diff) | |
download | scummvm-rg350-8f70ee9afc877b22123269669d155e710a467c4b.tar.gz scummvm-rg350-8f70ee9afc877b22123269669d155e710a467c4b.tar.bz2 scummvm-rg350-8f70ee9afc877b22123269669d155e710a467c4b.zip |
TSAGE: Wait for fading sounds to completely fade when changing scenes
-rw-r--r-- | engines/tsage/scenes.cpp | 5 | ||||
-rw-r--r-- | engines/tsage/sound.cpp | 16 | ||||
-rw-r--r-- | engines/tsage/sound.h | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index f6c2c03f64..3e23205633 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -173,6 +173,11 @@ void SceneManager::changeScene(int newSceneNumber) { // Blank out the screen _globals->_screenSurface.fillRect(_globals->_screenSurface.getBounds(), 0); + // If there are any fading sounds, wait until fading is complete + while (_globals->_soundManager.isFading()) { + g_system->delayMillis(10); + } + // Set the new scene to be loaded setNewScene(newSceneNumber); } diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index d054949f2d..1754bd71b9 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -451,6 +451,22 @@ void SoundManager::_sfProcessFading() { } } +bool SoundManager::isFading() { + Common::StackLock slock(sfManager()._serverSuspendedMutex); + + // Loop through any active sounds to see if any are being actively faded + Common::List<Sound *>::iterator i = sfManager()._playList.begin(); + while (i != sfManager()._playList.end()) { + Sound *s = *i; + ++i; + + if (s->_fadeDest != -1) + return true; + } + + return false; +} + void SoundManager::_sfUpdateVoiceStructs() { for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) { VoiceTypeStruct *vs = sfManager()._voiceTypeStructPtrs[voiceIndex]; diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index 702a2776f7..46a29e57a4 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -225,6 +225,7 @@ public: int getMasterVol() const; void loadSound(int soundNum, bool showErrors); void unloadSound(int soundNum); + bool isFading(); // _sf methods static SoundManager &sfManager(); |