aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormd52011-04-03 14:33:06 +0300
committermd52011-04-03 14:37:15 +0300
commit96540686597cb033281e98de79ddc9622e650057 (patch)
treec14e7be9b3ab44a879cce4ce2d8937b97f499475
parent51f733b2a6e2413a7a97442fc2389209da8a72f0 (diff)
downloadscummvm-rg350-96540686597cb033281e98de79ddc9622e650057.tar.gz
scummvm-rg350-96540686597cb033281e98de79ddc9622e650057.tar.bz2
scummvm-rg350-96540686597cb033281e98de79ddc9622e650057.zip
SCI: Fixed bug #3266480 and partially fixed bug #3041738
Hopefully, this will fix some of the oddities happening because of music fading
-rw-r--r--engines/sci/sound/music.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 0ed99c154b..8656203736 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -442,6 +442,25 @@ void SciMusic::soundPlay(MusicEntry *pSnd) {
if (pSnd->pMidiParser) {
Common::StackLock lock(_mutex);
pSnd->pMidiParser->mainThreadBegin();
+
+ if (pSnd->status != kSoundPaused) {
+ // Stop any in progress music fading, as that will reset the
+ // volume of the sound channels that the faded song occupies..
+ // Fixes bug #3266480 and partially fixes bug #3041738.
+ for (uint i = 0; i < playListCount; i++) {
+ // Is another MIDI song being faded? If yes, stop it
+ // immediately instead
+ if (_playList[i]->fadeStep && _playList[i]->pMidiParser) {
+ _playList[i]->status = kSoundStopped;
+ if (_soundVersion <= SCI_VERSION_0_LATE)
+ _playList[i]->isQueued = false;
+ _playList[i]->pMidiParser->stop();
+ freeChannels(_playList[i]);
+ _playList[i]->fadeStep = 0;
+ }
+ }
+ }
+
pSnd->pMidiParser->tryToOwnChannels();
if (pSnd->status != kSoundPaused)
pSnd->pMidiParser->sendInitCommands();