TSAGE: Wait for fading sounds to completely fade when changing scenes

This commit is contained in:
Paul Gilbert 2011-08-01 22:36:21 +10:00
parent 10033ca976
commit 8f70ee9afc
3 changed files with 22 additions and 0 deletions

View File

@ -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);
}

View File

@ -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];

View File

@ -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();