[Scummvm-cvs-logs] CVS: scummvm/sound midiparser.cpp,1.18,1.19

Max Horn fingolfin at users.sourceforge.net
Wed Dec 24 04:55:02 CET 2003


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv31688

Modified Files:
	midiparser.cpp 
Log Message:
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 ;-)

Index: midiparser.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/midiparser.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- midiparser.cpp	8 Nov 2003 23:05:04 -0000	1.18
+++ midiparser.cpp	24 Dec 2003 12:54:33 -0000	1.19
@@ -237,7 +237,18 @@
 	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)





More information about the Scummvm-git-logs mailing list