diff options
author | Max Horn | 2003-12-24 12:54:33 +0000 |
---|---|---|
committer | Max Horn | 2003-12-24 12:54:33 +0000 |
commit | 3472e930513cce9268d99bee7a69aa29ee9720af (patch) | |
tree | 82e0f57b4b09a1c950b3779ddfabf184c1f7c9e2 | |
parent | 032d8ad52e82de5f171de1abf751ae5a5bb122f7 (diff) | |
download | scummvm-rg350-3472e930513cce9268d99bee7a69aa29ee9720af.tar.gz scummvm-rg350-3472e930513cce9268d99bee7a69aa29ee9720af.tar.bz2 scummvm-rg350-3472e930513cce9268d99bee7a69aa29ee9720af.zip |
explicitly turn off all active sounds -> not all MIDI devices support the 'All note off' event, at least according to http://crystal.apana.org.au/ghansper/midi_introduction/midi_channel_mode.html ; and now, the quicktime MIDI code doesn't support it anymore, too ;-)
svn-id: r11885
-rw-r--r-- | sound/midiparser.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sound/midiparser.cpp b/sound/midiparser.cpp index 749d8bcd59..6bcfb43bfd 100644 --- a/sound/midiparser.cpp +++ b/sound/midiparser.cpp @@ -237,7 +237,18 @@ void MidiParser::allNotesOff() { if (!_driver) return; - int i; + int i, j; + + // Turn off all active notes + for (i = 0; i < 128; ++i) { + for (j = 0; j < 16; ++j) { + if (_active_notes[i] & (1 << j)) { + _driver->send (0x80 | j | i << 8); + } + } + } + + // 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) |