[Scummvm-cvs-logs] CVS: scummvm/backends/midi ypa1.cpp,1.2,1.3

Chris Apers chrilith at users.sourceforge.net
Thu May 29 05:10:04 CEST 2003


Update of /cvsroot/scummvm/scummvm/backends/midi
In directory sc8-pr-cvs1:/tmp/cvs-serv31784

Modified Files:
	ypa1.cpp 
Log Message:
Fix a sound problem on exit

Index: ypa1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/ypa1.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ypa1.cpp	28 May 2003 18:36:29 -0000	1.2
+++ ypa1.cpp	29 May 2003 12:09:33 -0000	1.3
@@ -25,19 +25,18 @@
 	if (!(_isOpen = Pa1Lib_midiOpen(NULL, &_midiHandle)))
 		return MERR_DEVICE_NOT_AVAILABLE;
 
-	Pa1Lib_midiControlChange(_midiHandle,0,120,0); // all sound off
-	Pa1Lib_midiControlChange(_midiHandle,0,121,0); // reset all controller
-	Pa1Lib_midiControlChange(_midiHandle,0,123,0); // all notes off
-
 	return 0;
 }
 
 void MidiDriver_YamahaPa1::close() {
 	if (_isOpen) {
-		Pa1Lib_midiControlChange(_midiHandle,0,120,0); // all sound off
-		Pa1Lib_midiControlChange(_midiHandle,0,121,0); // reset all controller
-		Pa1Lib_midiControlChange(_midiHandle,0,123,0); // all notes off
+		for (UInt8 channel = 0; channel < 16; channel++) {
+			Pa1Lib_midiControlChange(_midiHandle, channel, 120,0); // all sound off
+			Pa1Lib_midiControlChange(_midiHandle, channel, 121,0); // reset all controller
+			Pa1Lib_midiControlChange(_midiHandle, channel, 123, 0); // all notes off
+		}
 		Pa1Lib_midiClose(_midiHandle);
+		_isOpen = false;
 	}
 }
 





More information about the Scummvm-git-logs mailing list