diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/sound/midiparser_sci.cpp | 14 | ||||
-rw-r--r-- | engines/sci/sound/music.cpp | 8 | ||||
-rw-r--r-- | engines/sci/sound/music.h | 7 |
3 files changed, 27 insertions, 2 deletions
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 6ec28a8b02..769df73365 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -445,7 +445,12 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { } if (_signalSet) { _signalSet = false; - _pSnd->signal = _signalToSet; + if (!_pSnd->signal) { + _pSnd->signal = _signalToSet; + } else { + // signal already set and waiting for getting to scripts, queue new one + _pSnd->signalQueue.push_back(_signalToSet); + } debugC(4, kDebugLevelSound, "signal %04x", _signalToSet); } @@ -608,7 +613,12 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { jumpToTick(_loopTick); } else { _pSnd->status = kSoundStopped; - _pSnd->signal = SIGNAL_OFFSET; + if (!_pSnd->signal) { + _pSnd->signal = SIGNAL_OFFSET; + } else { + // signal already set and waiting for getting to scripts, queue new one + _pSnd->signalQueue.push_back(SIGNAL_OFFSET); + } debugC(4, kDebugLevelSound, "signal EOT"); } diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index c9a7de7b1c..fc1e56fcea 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -638,6 +638,14 @@ MusicEntry::~MusicEntry() { } void MusicEntry::onTimer() { + if (!signal) { + if (!signalQueue.empty()) { + // no signal set, but signal in queue, set that one + signal = signalQueue[0]; + signalQueue.remove_at(0); + } + } + if (status != kSoundPlaying) return; diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h index 37e3c30030..3cf600fcf3 100644 --- a/engines/sci/sound/music.h +++ b/engines/sci/sound/music.h @@ -51,6 +51,8 @@ enum SoundStatus { class MidiParser_SCI; class SegManager; +typedef Common::Array<uint16> SignalQueue; + class MusicEntry : public Common::Serializable { public: // Do not get these directly for the sound objects! @@ -90,6 +92,11 @@ public: MidiParser_SCI *pMidiParser; + // this is used for storing signals, when the current signal is not yet + // sent to the scripts. We shouldn't need to save it, this normally only + // happens in rare situations like lb1, knocking on the door in the attic + SignalQueue signalQueue; + // TODO: We need to revise how we store the different // audio stream objects we require. Audio::RewindableAudioStream *pStreamAud; |