diff options
author | Torbjörn Andersson | 2004-05-31 08:51:10 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-05-31 08:51:10 +0000 |
commit | 6dc0191e037a9103260fe7190d6eea4f8477ce84 (patch) | |
tree | b479c8b05143b59e13ee860976a0cd51effed3e1 | |
parent | cddf02fc3253668174707dad515a8152f1c47460 (diff) | |
download | scummvm-rg350-6dc0191e037a9103260fe7190d6eea4f8477ce84.tar.gz scummvm-rg350-6dc0191e037a9103260fe7190d6eea4f8477ce84.tar.bz2 scummvm-rg350-6dc0191e037a9103260fe7190d6eea4f8477ce84.zip |
Make allNotesOff() also turn off all "hanging notes". Without this change,
I wasn't able to fully stop ITE's XMIDI music - there would always be a
couple of notes hanging even after unloading it. Apparently this music
doesn't use the "active notes" mechanism at all, and I guess the ALSA
driver doesn't support the "All Note Off" event.
I'm still not 100% sure this is the correct fix, but unless someone has any
better idea...
svn-id: r13910
-rw-r--r-- | sound/midiparser.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/midiparser.cpp b/sound/midiparser.cpp index c2c97a5de1..48d8f6d0d1 100644 --- a/sound/midiparser.cpp +++ b/sound/midiparser.cpp @@ -248,12 +248,18 @@ void MidiParser::allNotesOff() { } } + // Turn off all hanging notes + for (i = 0; i < ARRAYSIZE(_hanging_notes); i++) { + if (_hanging_notes[i].time_left) { + _driver->send (0x80 | _hanging_notes[i].channel | _hanging_notes[i].note << 8); + _hanging_notes[i].time_left = 0; + } + } + _hanging_notes_count = 0; + // To be sure, send an "All Note Off" event (but not all MIDI devices support this...) for (i = 0; i < 16; ++i) _driver->send (0x007BB0 | i); - for (i = 0; i < ARRAYSIZE(_hanging_notes); ++i) - _hanging_notes[i].time_left = 0; - _hanging_notes_count = 0; memset (_active_notes, 0, sizeof(_active_notes)); } |