diff options
-rw-r--r-- | engines/sci/sfx/music.cpp | 5 | ||||
-rw-r--r-- | engines/sci/sfx/music.h | 2 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 12 |
3 files changed, 12 insertions, 7 deletions
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 1a98a58a02..cedcd1c923 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -534,7 +534,7 @@ MusicEntry::MusicEntry() { fadeStep = 0; fadeTicker = 0; fadeTickerStep = 0; - fadeVolumeSet = false; + fadeSetVolume = false; status = kSoundStopped; @@ -579,8 +579,7 @@ void MusicEntry::doFade() { // Only process MIDI streams in this thread, not digital sound effects if (pMidiParser) pMidiParser->setVolume(volume); - if (pStreamAud) - fadeVolumeSet = true; // set flag so that SoundCommandParser::cmdUpdateCues will set the volume of the stream + fadeSetVolume = true; // set flag so that SoundCommandParser::cmdUpdateCues will set the volume of the stream } } diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h index 6087202cb0..f59e594939 100644 --- a/engines/sci/sfx/music.h +++ b/engines/sci/sfx/music.h @@ -93,7 +93,7 @@ public: short fadeStep; uint32 fadeTicker; uint32 fadeTickerStep; - bool fadeVolumeSet; + bool fadeSetVolume; SoundStatus status; diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index b5c79a6f6c..3179f80a7c 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -790,9 +790,9 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { musicSlot->ticker = (uint16)(mixer->getSoundElapsedTime(musicSlot->hCurrentAud) * 0.06); } // We get a flag from MusicEntry::doFade() here to set volume for the stream - if (musicSlot->fadeVolumeSet) { + if (musicSlot->fadeSetVolume) { mixer->setChannelVolume(musicSlot->hCurrentAud, musicSlot->volume); - musicSlot->fadeVolumeSet = false; + musicSlot->fadeSetVolume = false; } } else { switch (musicSlot->signal) { @@ -803,7 +803,13 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { } break; case SIGNAL_OFFSET: - cmdStopSound(obj, 0); + // Check if this signal is the end of the track or the end of fading effect. + // If this came from a fading effect, don't stop the track here, it'll be stopped + // by the engine scripts + if (musicSlot->fadeSetVolume) + musicSlot->fadeSetVolume = false; + else + cmdStopSound(obj, 0); break; default: // Sync the signal of the sound object |