[Scummvm-cvs-logs] CVS: scummvm/sound midiparser.cpp,1.21,1.22

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Mon May 31 01:52:02 CEST 2004


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17944

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


Index: midiparser.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/midiparser.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- midiparser.cpp	29 Apr 2004 11:57:25 -0000	1.21
+++ midiparser.cpp	31 May 2004 08:51:10 -0000	1.22
@@ -248,12 +248,18 @@
 		}
 	}
 
+	// 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));
 }
 





More information about the Scummvm-git-logs mailing list