From 705d3c2d85b30368a7b138328cdd99040fe0bf28 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Thu, 17 Jun 2010 08:41:04 +0000 Subject: SCI: fixes regressions of r49905 (thx to digitall) - first we now find out what channels are used in sci0 as well, we are doing straight mapping for sci0 though - this fixes music in sci0 games, also fixing crash in sq1vga because of using null pMidiParser svn-id: r49922 --- engines/sci/sound/midiparser_sci.cpp | 4 ++++ engines/sci/sound/music.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'engines/sci/sound') diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 189d9b8727..bdb907a451 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -545,6 +545,10 @@ byte *MidiParser_SCI::midiFilterChannels(int channelMask) { break; default: // MIDI command + // remember which channel got used for channel remapping + byte midiChannel = command & 0xF; + _channelUsed[midiChannel] = true; + if (lastCommand != command) { *outData++ = command; debugC(4, kDebugLevelSound, "%02X ", command); diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 213d3830c7..a1c6cc0a56 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -232,6 +232,9 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { // This one checks, if requested channel is available -> in that case give caller that channel // Otherwise look for an unused one int16 SciMusic::tryToOwnChannel(MusicEntry *caller, int16 bestChannel) { + // Don't even try this for SCI0 + if (_soundVersion <= SCI_VERSION_0_LATE) + return bestChannel; if (!_usedChannel[bestChannel]) { // currently unused, so give it to caller directly _usedChannel[bestChannel] = caller; @@ -308,9 +311,9 @@ void SciMusic::soundPlay(MusicEntry *pSnd) { DisposeAfterUse::NO); } } else { - pSnd->pMidiParser->tryToOwnChannels(); _mutex.lock(); if (pSnd->pMidiParser) { + pSnd->pMidiParser->tryToOwnChannels(); pSnd->pMidiParser->setVolume(pSnd->volume); if (pSnd->status == kSoundStopped) pSnd->pMidiParser->jumpToTick(0); -- cgit v1.2.3