diff options
author | Martin Kiewitz | 2010-06-21 10:51:14 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-06-21 10:51:14 +0000 |
commit | cfcf53bec0f566d8fc20c5ba75ccdc00ba62ee86 (patch) | |
tree | 72da6d88e85641e3b665c54ef94ad1a6c63dc5c0 | |
parent | 8fce6600904e2094de6488e01540fca1433b1530 (diff) | |
download | scummvm-rg350-cfcf53bec0f566d8fc20c5ba75ccdc00ba62ee86.tar.gz scummvm-rg350-cfcf53bec0f566d8fc20c5ba75ccdc00ba62ee86.tar.bz2 scummvm-rg350-cfcf53bec0f566d8fc20c5ba75ccdc00ba62ee86.zip |
SCI: fix regression of r50073, allNotesOff() now directly sends to driver again. If we send to queue, queue will never actually get processed and even if it was, the channels wouldnt be mapped anymore anyway
svn-id: r50110
-rw-r--r-- | engines/sci/sound/midiparser_sci.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 640000235e..734b2fdda9 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -389,19 +389,23 @@ void MidiParser_SCI::allNotesOff() { int i, j; + // Note: we send to driver here directly, because in this case we would free previously mapped channels + // and onTimer() wouldn't send them to driver anymore afterwards anyway + // Turn off all active notes for (i = 0; i < 128; ++i) { for (j = 0; j < 16; ++j) { - if ((_active_notes[i] & (1 << j))){ - sendToDriverQueue(0x80 | j, i, 0); + if ((_active_notes[i] & (1 << j)) && (_channelRemap[j] != -1)){ + sendToDriver(0x80 | j, i, 0); } } } // Turn off all hanging notes for (i = 0; i < ARRAYSIZE(_hanging_notes); i++) { - if (_hanging_notes[i].time_left) { - sendToDriverQueue(0x80 | _hanging_notes[i].channel, _hanging_notes[i].note, 0); + byte midiChannel = _hanging_notes[i].channel; + if ((_hanging_notes[i].time_left) && (_channelRemap[midiChannel] != -1)) { + sendToDriver(0x80 | midiChannel, _hanging_notes[i].note, 0); _hanging_notes[i].time_left = 0; } } @@ -410,8 +414,10 @@ void MidiParser_SCI::allNotesOff() { // To be sure, send an "All Note Off" event (but not all MIDI devices // support this...). - for (i = 0; i < 16; ++i) - sendToDriverQueue(0xB0 | i, 0x7b, 0); // All notes off + for (i = 0; i < 16; ++i) { + if (_channelRemap[i] != -1) + sendToDriver(0xB0 | i, 0x7b, 0); // All notes off + } memset(_active_notes, 0, sizeof(_active_notes)); } |