diff options
-rw-r--r-- | engines/sci/sound/soundcmd.cpp | 16 | ||||
-rw-r--r-- | engines/sci/sound/soundcmd.h | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index 20bce575f5..48b65c2810 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -498,6 +498,10 @@ void SoundCommandParser::cmdDisposeSound(reg_t obj, int16 value) { } void SoundCommandParser::cmdStopSound(reg_t obj, int16 value) { + processStopSound(obj, value, false); +} + +void SoundCommandParser::processStopSound(reg_t obj, int16 value, bool sampleFinishedPlaying) { if (!obj.segment) return; @@ -517,9 +521,17 @@ void SoundCommandParser::cmdStopSound(reg_t obj, int16 value) { PUT_SEL32V(_segMan, obj, SELECTOR(state), kSoundStopped); } else { PUT_SEL32V(_segMan, obj, SELECTOR(handle), 0); - PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET); } + // Set signal selector in sound SCI0 games only, when the sample has finished playing + // If we don't set it at all, we get a problem when using vaporizer on the 2 guys + // If we set it all the time, we get no music in sq3new and kq1 + // FIXME: this *may* be wrong, it's impossible to find out in sierra DOS sci, because SCI0 under DOS didn't have + // sfx drivers included + // We need to set signal in sound SCI1+ games all the time + if ((_soundVersion > SCI_VERSION_0_LATE) || sampleFinishedPlaying) + PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET); + musicSlot->dataInc = 0; musicSlot->signal = 0; _music->soundStop(musicSlot); @@ -812,7 +824,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { musicSlot->sampleLoopCounter = currentLoopCounter; } if (!_music->soundIsActive(musicSlot)) { - cmdStopSound(obj, 0); + processStopSound(obj, 0, true); } else { _music->updateAudioStreamTicker(musicSlot); } diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h index 41ce9517a9..09cca23450 100644 --- a/engines/sci/sound/soundcmd.h +++ b/engines/sci/sound/soundcmd.h @@ -130,6 +130,8 @@ private: void cmdSetSoundLoop(reg_t obj, int16 value); void cmdSuspendSound(reg_t obj, int16 value); + void processStopSound(reg_t obj, int16 value, bool sampleFinishedPlaying); + #ifdef USE_OLD_MUSIC_FUNCTIONS void changeSoundStatus(reg_t obj, int newStatus); #endif |