[Scummvm-cvs-logs] CVS: scummvm/sound midiparser_smf.cpp,1.10,1.11 midiparser_xmidi.cpp,1.9,1.10 mpu401.h,1.7,1.8
Jamieson Christian
jamieson630 at users.sourceforge.net
Thu May 22 21:19:07 CEST 2003
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv23810/sound
Modified Files:
midiparser_smf.cpp midiparser_xmidi.cpp mpu401.h
Log Message:
Revamped iMuse and Player classes. Player now uses MidiParser to parse its data, which will allow it to parse other MIDI formats. To receive parsed data, Player now derives from MidiDriver to act as a "fake MIDI driver".
Miscellaneous upgrades and fixes to MidiParser, including the Smart Jump (which could not be tested before iMuse started making use of the MidiParser).
*** THIS IS A BIG UPGRADE! EXTENSIVE REGRESSION TESTING IS NEEDED! ***
This has been tested through the intros and a number of other scenes from MI2, FOA and S&M.
NOTE! This upgrade introduces savegame format version V19. Earlier version savegames will load, but the music will simply start over from the beginning. Only V19 and later games will properly restore the position of the music! Don't say you weren't warned....
Index: midiparser_smf.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/midiparser_smf.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- midiparser_smf.cpp 22 May 2003 15:34:30 -0000 1.10
+++ midiparser_smf.cpp 23 May 2003 04:18:46 -0000 1.11
@@ -80,8 +80,8 @@
}
void MidiParser_SMF::parseNextEvent (EventInfo &info) {
- info.start = _play_pos;
- info.delta = readVLQ (_play_pos);
+ info.start = _position._play_pos;
+ info.delta = readVLQ (_position._play_pos);
// Process the next info. If mpMalformedPitchBends
// was set, we must skip over any pitch bend events
@@ -89,23 +89,24 @@
// real pitch bend events, they're just two-byte
// prefixes before the real info.
do {
- if ((_play_pos[0] & 0xF0) >= 0x80)
- info.event = *(_play_pos++);
+ if ((_position._play_pos[0] & 0xF0) >= 0x80)
+ info.event = *(_position._play_pos++);
else
- info.event = _running_status;
- } while (_malformedPitchBends && (info.event & 0xF0) == 0xE0 && _play_pos++);
+ info.event = _position._running_status;
+ } while (_malformedPitchBends && (info.event & 0xF0) == 0xE0 && _position._play_pos++);
if (info.event < 0x80)
return;
+ _position._running_status = info.event;
switch (info.command()) {
case 0xC: case 0xD:
- info.basic.param1 = *(_play_pos++);
+ info.basic.param1 = *(_position._play_pos++);
info.basic.param2 = 0;
break;
case 0x8: case 0x9: case 0xA: case 0xB: case 0xE:
- info.basic.param1 = *(_play_pos++);
- info.basic.param2 = *(_play_pos++);
+ info.basic.param1 = *(_position._play_pos++);
+ info.basic.param2 = *(_position._play_pos++);
if (info.command() == 0x9 && info.basic.param2 == 0)
info.event = info.channel() | 0x80;
info.length = 0;
@@ -114,12 +115,12 @@
case 0xF: // System Common, Meta or SysEx event
switch (info.event & 0x0F) {
case 0x2: // Song Position Pointer
- info.basic.param1 = *(_play_pos++);
- info.basic.param2 = *(_play_pos++);
+ info.basic.param1 = *(_position._play_pos++);
+ info.basic.param2 = *(_position._play_pos++);
break;
case 0x3: // Song Select
- info.basic.param1 = *(_play_pos++);
+ info.basic.param1 = *(_position._play_pos++);
info.basic.param2 = 0;
break;
@@ -128,16 +129,16 @@
break;
case 0x0: // SysEx
- info.length = readVLQ (_play_pos);
- info.ext.data = _play_pos;
- _play_pos += info.length;
+ info.length = readVLQ (_position._play_pos);
+ info.ext.data = _position._play_pos;
+ _position._play_pos += info.length;
break;
case 0xF: // META event
- info.ext.type = *(_play_pos++);
- info.length = readVLQ (_play_pos);
- info.ext.data = _play_pos;
- _play_pos += info.length;
+ info.ext.type = *(_position._play_pos++);
+ info.length = readVLQ (_position._play_pos);
+ info.ext.data = _position._play_pos;
+ _position._play_pos += info.length;
break;
}
}
@@ -192,8 +193,8 @@
}
// Now we identify and store the location for each track.
- if (_num_tracks > 16) {
- printf ("Can only handle 16 tracks but was handed %d\n", (int) _num_tracks);
+ if (_num_tracks > ARRAYSIZE(_tracks)) {
+ printf ("Can only handle %d tracks but was handed %d\n", (int) ARRAYSIZE(_tracks), (int) _num_tracks);
return false;
}
Index: midiparser_xmidi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/midiparser_xmidi.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- midiparser_xmidi.cpp 22 May 2003 15:34:30 -0000 1.9
+++ midiparser_xmidi.cpp 23 May 2003 04:18:46 -0000 1.10
@@ -76,17 +76,17 @@
}
void MidiParser_XMIDI::parseNextEvent (EventInfo &info) {
- info.start = _play_pos;
- info.delta = readVLQ2 (_play_pos) - _inserted_delta;
+ info.start = _position._play_pos;
+ info.delta = readVLQ2 (_position._play_pos) - _inserted_delta;
// Process the next event.
_inserted_delta = 0;
- info.event = *(_play_pos++);
+ info.event = *(_position._play_pos++);
switch (info.event >> 4) {
case 0x9: // Note On
- info.basic.param1 = *(_play_pos++);
- info.basic.param2 = *(_play_pos++);
- info.length = readVLQ (_play_pos);
+ info.basic.param1 = *(_position._play_pos++);
+ info.basic.param2 = *(_position._play_pos++);
+ info.length = readVLQ (_position._play_pos);
if (info.basic.param2 == 0) {
info.event = info.channel() | 0x80;
info.length = 0;
@@ -94,24 +94,24 @@
break;
case 0xC: case 0xD:
- info.basic.param1 = *(_play_pos++);
+ info.basic.param1 = *(_position._play_pos++);
info.basic.param2 = 0;
break;
case 0x8: case 0xA: case 0xB: case 0xE:
- info.basic.param1 = *(_play_pos++);
- info.basic.param2 = *(_play_pos++);
+ info.basic.param1 = *(_position._play_pos++);
+ info.basic.param2 = *(_position._play_pos++);
break;
case 0xF: // Meta or SysEx event
switch (info.event & 0x0F) {
case 0x2: // Song Position Pointer
- info.basic.param1 = *(_play_pos++);
- info.basic.param2 = *(_play_pos++);
+ info.basic.param1 = *(_position._play_pos++);
+ info.basic.param2 = *(_position._play_pos++);
break;
case 0x3: // Song Select
- info.basic.param1 = *(_play_pos++);
+ info.basic.param1 = *(_position._play_pos++);
info.basic.param2 = 0;
break;
@@ -120,16 +120,16 @@
break;
case 0x0: // SysEx
- info.length = readVLQ (_play_pos);
- info.ext.data = _play_pos;
- _play_pos += info.length;
+ info.length = readVLQ (_position._play_pos);
+ info.ext.data = _position._play_pos;
+ _position._play_pos += info.length;
break;
case 0xF: // META event
- info.ext.type = *(_play_pos++);
- info.length = readVLQ (_play_pos);
- info.ext.data = _play_pos;
- _play_pos += info.length;
+ info.ext.type = *(_position._play_pos++);
+ info.length = readVLQ (_position._play_pos);
+ info.ext.data = _position._play_pos;
+ _position._play_pos += info.length;
if (info.ext.type == 0x51 && info.length == 3) {
// Tempo event. We want to make these constant 500,000.
info.ext.data[0] = 0x07;
@@ -236,8 +236,8 @@
// Ok it's an XMIDI.
// We're going to identify and store the location for each track.
- if (_num_tracks > 16) {
- printf ("Can only handle 16 tracks but was handed %d\n", (int) _num_tracks);
+ if (_num_tracks > ARRAYSIZE(_tracks)) {
+ printf ("Can only handle %d tracks but was handed %d\n", (int) ARRAYSIZE(_tracks), (int) _num_tracks);
return false;
}
Index: mpu401.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mpu401.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mpu401.h 16 May 2003 21:05:58 -0000 1.7
+++ mpu401.h 23 May 2003 04:18:46 -0000 1.8
@@ -88,7 +88,7 @@
MidiDriver_MPU401();
void setTimerCallback(void *timer_param, void (*timer_proc) (void *));
- uint32 getBaseTempo(void) { return 0x4A0000; }
+ uint32 getBaseTempo(void) { return 10000; } // 0x4A0000; } // Now referenced in microseconds between callbacks
virtual void sysEx_customInstrument (byte channel, uint32 type, byte *instr);
More information about the Scummvm-git-logs
mailing list