From cfcf53bec0f566d8fc20c5ba75ccdc00ba62ee86 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Mon, 21 Jun 2010 10:51:14 +0000 Subject: 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 --- engines/sci/sound/midiparser_sci.cpp | 18 ++++++++++++------ 1 file 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)); } -- cgit v1.2.3