aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound
diff options
context:
space:
mode:
authorMartin Kiewitz2010-06-17 08:41:04 +0000
committerMartin Kiewitz2010-06-17 08:41:04 +0000
commit705d3c2d85b30368a7b138328cdd99040fe0bf28 (patch)
tree86f84f1085486ca780af5ebfc36954d76b397855 /engines/sci/sound
parent25496abe1b494e125cc8dd7892e9c95e3da61042 (diff)
downloadscummvm-rg350-705d3c2d85b30368a7b138328cdd99040fe0bf28.tar.gz
scummvm-rg350-705d3c2d85b30368a7b138328cdd99040fe0bf28.tar.bz2
scummvm-rg350-705d3c2d85b30368a7b138328cdd99040fe0bf28.zip
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
Diffstat (limited to 'engines/sci/sound')
-rw-r--r--engines/sci/sound/midiparser_sci.cpp4
-rw-r--r--engines/sci/sound/music.cpp5
2 files changed, 8 insertions, 1 deletions
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);