[Scummvm-cvs-logs] CVS: scummvm/simon midi.cpp,1.44,1.45

Jamieson Christian jamieson630 at users.sourceforge.net
Fri May 23 21:40:08 CEST 2003


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv13030/scummvm/simon

Modified Files:
	midi.cpp 
Log Message:
Fixed hanging notes when switching tracks

Index: midi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/midi.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- midi.cpp	24 May 2003 03:55:37 -0000	1.44
+++ midi.cpp	24 May 2003 04:39:47 -0000	1.45
@@ -90,7 +90,7 @@
 		b = (b & 0xFF00FFFF) | (volume << 16);
 	} else if ((b & 0xFFF0) == 0x007BB0) {
 		// Only respond to an All Notes Off if this channel
-		// has already been marked "in use" by this parser.
+		// has already been allocated.
 		if (!_current->channel [b & 0x0F])
 			return;
 	}
@@ -99,7 +99,7 @@
 	if (!_current->channel [channel])
 		_current->channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
 	if (_current->channel [channel])
-		_driver->send ((b & ~0x0F) | _current->channel[channel]->getNumber());
+		_driver->send ((b & 0xFFFFFFF0) | _current->channel[channel]->getNumber());
 }
 
 void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) {
@@ -156,7 +156,9 @@
 		_system->lock_mutex (_mutex);
 
 		if (_music.parser) {
+			_current = &_music;
 			delete _music.parser;
+			_current = 0;
 			_music.parser = 0;
 		}
 
@@ -179,7 +181,9 @@
 			return;
 		}
 		_currentTrack = (byte) track;
+		_current = &_music;
 		_music.parser->jumpToTick (0);
+		_current = 0;
 	}
 
 	_system->unlock_mutex (_mutex);
@@ -187,8 +191,11 @@
 
 void MidiPlayer::stop() {
 	_system->lock_mutex (_mutex);
-	if (_music.parser)
+	if (_music.parser) {
+		_current = &_music;
 		_music.parser->jumpToTick(0);
+	}
+	_current = 0;
 	_currentTrack = 255;
 	_system->unlock_mutex (_mutex);
 }





More information about the Scummvm-git-logs mailing list