[Scummvm-cvs-logs] CVS: scummvm/sound midiparser_xmidi.cpp,1.1,1.2 mididrv.h,1.20,1.21

Jamieson Christian jamieson630 at users.sourceforge.net
Sun May 18 07:51:08 CEST 2003


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

Modified Files:
	midiparser_xmidi.cpp mididrv.h 
Log Message:
MIDI Meta event Tx for virtual MidiDriver's

Index: midiparser_xmidi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/midiparser_xmidi.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- midiparser_xmidi.cpp	18 May 2003 14:25:33 -0000	1.1
+++ midiparser_xmidi.cpp	18 May 2003 14:50:10 -0000	1.2
@@ -139,7 +139,6 @@
 	uint32 length;
 	int i;
 	NoteTimer *ptr;
-	bool active_notes;
 	byte note;
 	byte vel;
 	uint32 note_length;
@@ -156,8 +155,6 @@
 	pos = _play_pos;
 
 	// Send any necessary note off events.
-	active_notes = false;
-
 	ptr = &_notes_cache[0];
 	for (i = ARRAYSIZE(_notes_cache); i; --i, ++ptr) {
 		if (ptr->time_left) {
@@ -165,7 +162,6 @@
 				_driver->send (0x80 | ptr->channel | (ptr->note << 8));
 				ptr->time_left = 0;
 			} else {
-				active_notes = true;
 				ptr->time_left -= _timer_rate;
 			}
 		}
@@ -243,31 +239,27 @@
 
 			case 0xF: // META event
 				event = *pos++;
-				// Skip any META events except end of song.
+				length = readVLQ (pos);
+				_driver->metaEvent (event, pos, (uint16) length);
+
+				// End of song must be processed by us,
+				// as well as sending it to the output device.
 				if (event == 0x2F) {
 					// End of song. See if there are still holding notes
 					// we need to wait for.
-					if (!active_notes) {
-						_play_pos = 0;
-						setTrack (_active_track + 1);
-					} else {
-						// Still active notes. Back up to the start of this
-						// event once again, and set all note timings to
-						// 1. That way they'll get turned off next clock.
-						ptr = &_notes_cache[0];
-						for (i = ARRAYSIZE(_notes_cache); i; --i, ++ptr) {
-							if (ptr->time_left)
-								ptr->time_left = 1;
+					ptr = &_notes_cache[0];
+					for (i = ARRAYSIZE(_notes_cache); i; --i, ++ptr) {
+						if (ptr->time_left) {
+							_driver->send (0x80 | ptr->channel | (ptr->note << 8));
+							ptr->time_left = 0;
 						}
-						_play_pos -= 2;
 					}
+					_play_pos = 0;
 					_lock = 0;
 					return;
-				} else {
-					length = readVLQ (pos);
-					pos += length;
 				}
-				break;
+
+				pos += length;
 			}
 		}
 

Index: mididrv.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mididrv.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mididrv.h	17 May 2003 17:20:27 -0000	1.20
+++ mididrv.h	18 May 2003 14:50:10 -0000	1.21
@@ -72,6 +72,7 @@
 
 	virtual void sysEx (byte *msg, uint16 length) { }
 	virtual void sysEx_customInstrument (byte channel, uint32 type, byte *instr) { }
+	virtual void metaEvent (byte type, byte*data, uint16 length) { }
 
 	// Timing functions - MidiDriver now operates timers
 	virtual void setTimerCallback (void *timer_param, void (*timer_proc) (void *)) = 0;





More information about the Scummvm-git-logs mailing list