diff options
-rw-r--r-- | engines/sci/sound/midiparser_sci.cpp | 6 | ||||
-rw-r--r-- | engines/sci/sound/midiparser_sci.h | 1 | ||||
-rw-r--r-- | engines/sci/sound/music.cpp | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 50a2407dde..099d4572be 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -648,6 +648,12 @@ void MidiParser_SCI::tryToOwnChannels() { } } +void MidiParser_SCI::lostChannels() { + for (int curChannel = 0; curChannel < 15; curChannel++) + if ((_channelUsed[curChannel]) && (curChannel != 9)) + _channelRemap[curChannel] = -1; +} + void MidiParser_SCI::setVolume(byte volume) { // FIXME: This receives values > 127... throw a warning for now and clip the variable if (volume > MUSIC_VOLUME_MAX) { diff --git a/engines/sci/sound/midiparser_sci.h b/engines/sci/sound/midiparser_sci.h index dbd37018b1..8b796d01fc 100644 --- a/engines/sci/sound/midiparser_sci.h +++ b/engines/sci/sound/midiparser_sci.h @@ -81,6 +81,7 @@ public: const byte *getMixedData() const { return _mixedData; } void tryToOwnChannels(); + void lostChannels(); void sendFromScriptToDriver(uint32 midi); void sendToDriver(uint32 midi); void sendToDriver(byte status, byte firstOp, byte secondOp) { diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index d1555ca7a6..f10ff6d09a 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -287,6 +287,8 @@ void SciMusic::freeChannels(MusicEntry *caller) { if (_usedChannel[i] == caller) _usedChannel[i] = 0; } + // Also tell midiparser, that he lost ownership + caller->pMidiParser->lostChannels(); } void SciMusic::soundPlay(MusicEntry *pSnd) { |