aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-01-02 15:54:08 +0000
committerFilippos Karapetis2010-01-02 15:54:08 +0000
commitf62e2b2571b970edf5bf334dbd5a8e1b225a5a91 (patch)
treefedc9273faec89482cca3cf26609bd6c9be792ee
parent6c16673305727022b67f9203a87cc14a014637b6 (diff)
downloadscummvm-rg350-f62e2b2571b970edf5bf334dbd5a8e1b225a5a91.tar.gz
scummvm-rg350-f62e2b2571b970edf5bf334dbd5a8e1b225a5a91.tar.bz2
scummvm-rg350-f62e2b2571b970edf5bf334dbd5a8e1b225a5a91.zip
SCI/new music code: don't stop a music track if the fading effect has just finished. Fixes the music in GK1 (demo and full)
svn-id: r46887
-rw-r--r--engines/sci/sfx/music.cpp5
-rw-r--r--engines/sci/sfx/music.h2
-rw-r--r--engines/sci/sfx/soundcmd.cpp12
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