[Scummvm-cvs-logs] CVS: scummvm/sound midiparser.cpp,1.31,1.32 midiparser.h,1.27,1.28

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Tue Oct 11 23:58:28 CEST 2005


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

Modified Files:
	midiparser.cpp midiparser.h 
Log Message:
Looks like my pitch wheel change still has the ability to break things. See
bug #1324103.

I've changed it - again - so that now it only centers the pitch wheels on
unload if a new mpCenterPitchWheelOnUnload property has been set. Currently
only the SAGA engine does that, so if it still breaks it only breaks SAGA.

I've also fixed what looked like an unintentional fall-through in the
MidiParser::property() function. Surently that can't cause any new
regressions? Please.


Index: midiparser.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/midiparser.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- midiparser.cpp	11 Oct 2005 17:48:16 -0000	1.31
+++ midiparser.cpp	12 Oct 2005 06:57:25 -0000	1.32
@@ -39,6 +39,7 @@
 _psec_per_tick(5208), // 500000 / 96
 _autoLoop(false),
 _smartJump(false),
+_centerPitchWheelOnUnload(false),
 _num_tracks(0),
 _active_track(255),
 _abort_parse(0) {
@@ -49,8 +50,13 @@
 	switch (prop) {
 	case mpAutoLoop:
 		_autoLoop = (value != 0);
+		break;
 	case mpSmartJump:
 		_smartJump = (value != 0);
+		break;
+	case mpCenterPitchWheelOnUnload:
+		_centerPitchWheelOnUnload = (value != 0);
+		break;
 	}
 }
 
@@ -396,12 +402,16 @@
 	_active_track = 255;
 	_abort_parse = true;
 
-	// Center the pitch wheels in preparation for the next piece of music.
-	// It's not safe to do this from within allNotesOff().
+	if (_centerPitchWheelOnUnload) {
+		// Center the pitch wheels in preparation for the next piece of
+		// music. It's not safe to do this from within allNotesOff(),
+		// and might not even be safe here, so we only do it if the
+		// client has explicitly asked for it.
 
-	if (_driver) {
-		for (int i = 0; i < 16; ++i) {
-			_driver->send(0x4000E0 | i); // Center the pitch wheel
+		if (_driver) {
+			for (int i = 0; i < 16; ++i) {
+				_driver->send(0x4000E0 | i);
+			}
 		}
 	}
 }

Index: midiparser.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/midiparser.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- midiparser.h	27 May 2005 12:43:19 -0000	1.27
+++ midiparser.h	12 Oct 2005 06:57:25 -0000	1.28
@@ -276,6 +276,7 @@
 	uint32 _psec_per_tick;  //!< Microseconds per tick (_tempo / _ppqn).
 	bool   _autoLoop;       //!< For lightweight clients that don't provide their own flow control.
 	bool   _smartJump;      //!< Support smart expiration of hanging notes when jumping
+	bool   _centerPitchWheelOnUnload;  //!< Center the pitch wheels when unloading a song
 
 	// FIXME: ? Was 32 here, Kyra tracks use 120(!!!) which seems wrong. this is a hacky
 	// workaround until situation is investigated.
@@ -341,7 +342,8 @@
 	enum {
 		mpMalformedPitchBends = 1,
 		mpAutoLoop = 2,
-		mpSmartJump = 3
+		mpSmartJump = 3,
+		mpCenterPitchWheelOnUnload = 4
 	};
 
 public:





More information about the Scummvm-git-logs mailing list