[Scummvm-cvs-logs] CVS: scummvm/scumm midiparser_eup.cpp,1.2,1.3
Jamieson Christian
jamieson630 at users.sourceforge.net
Tue Sep 30 00:51:03 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/bs2 console.cpp,1.11,1.12 controls.cpp,1.19,1.20 debug.cpp,1.10,1.11 events.cpp,1.6,1.7 function.cpp,1.18,1.19 logic.cpp,1.15,1.16 logic.h,1.3,1.4 save_rest.cpp,1.19,1.20 speech.cpp,1.23,1.24 sword2.cpp,1.42,1.43
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.98,2.99 imuse_internal.h,2.24,2.25
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv28154/scummvm/scumm
Modified Files:
midiparser_eup.cpp
Log Message:
Refined Euphony parser behavior, specifically,
added proper handling for F2 events, and
experimental handling for malformed 9x/00 events.
Index: midiparser_eup.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/midiparser_eup.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- midiparser_eup.cpp 16 Sep 2003 21:28:46 -0000 1.2
+++ midiparser_eup.cpp 30 Sep 2003 07:50:20 -0000 1.3
@@ -40,7 +40,8 @@
int8 *transpose;
} _presets;
bool _loop;
- byte _presend; // Tracks which startup implied events have been sent.
+ byte _presend; // Tracks which startup implied events have been sent.
+ uint32 _base_tick; // Events times are relative to this base.
protected:
void parseNextEvent (EventInfo &info);
@@ -87,37 +88,37 @@
byte channel = _presets.channel[preset];
if (channel >= 16)
channel = cmd & 0x0F;
- uint16 tick = pos[2] | ((uint16) pos[3] << 7);
+ uint16 tick = (pos[2] | ((uint16) pos[3] << 7)) + _base_tick;
int note = (int) pos[4] + _presets.transpose[preset];
int volume = (int) pos[5] + _presets.volume[preset];
pos += 6;
- if ((*pos & 0xF0) == 0x80) {
- if (_presets.enable[preset]) {
- uint16 duration = pos[1] | (pos[2] << 4) | (pos[3] << 8) | (pos[4] << 12);
- info.start = pos;
- uint32 last = _position._last_event_tick;
- info.delta = (tick < last) ? 0 : (tick - last);
- info.event = 0x90 | channel;
- info.length = duration;
- info.basic.param1 = note;
- info.basic.param2 = volume;
- pos += 6;
- break;
- }
+ if (_presets.enable[preset]) {
+ // If the second half of the command pair is 8x,
+ // use four nibbles for the note duration. Otherwise
+ // assume it is 00 and only use two nibbles. This is
+ // a GUESS solution; however, it's clear from looking
+ // at Indy3-Towns dumps that 00 note off events use
+ // the third and fourth nibbles to report a "countdown"
+ // to the end of the song, for whatever weird reason.
+ uint16 duration = pos[1] | (pos[2] << 4) |
+ (((*pos & 0xF0) == 0x80) ? ((pos[3] << 8) | (pos[4] << 12)) : 0);
+ info.start = pos;
+ uint32 last = _position._last_event_tick;
+ info.delta = (tick < last) ? 0 : (tick - last);
+ info.event = 0x90 | channel;
+ info.length = duration;
+ info.basic.param1 = note;
+ info.basic.param2 = volume;
pos += 6;
+ break;
}
+ pos += 6;
} else if (cmd == 0xF2) {
- // This is basically a "rest".
- uint16 tick = pos[2] | (pos[3] << 7);
- uint32 last = _position._last_event_tick;
- info.start = pos;
- info.delta = (tick < last) ? 0 : (tick - last);
- info.event = 0xFF;
- info.length = 0;
- info.ext.type = 0x7F; // Bogus META event
- info.ext.data = pos;
+ // This is a "measure marker" of sorts.
+ // It advances the "base time", to which
+ // all event times are relative.
+ _base_tick += (pos[3] << 7) | pos[2];
pos += 6;
- break;
} else if (cmd == 0xF8) {
// TODO: Implement this.
pos += 6;
@@ -127,12 +128,13 @@
// TODO: Implement this.
} else {
info.start = pos;
- info.delta = 0;
+ uint32 last = _position._last_event_tick;
+ info.delta = (_base_tick < last) ? 0 : (_base_tick - last);
info.event = 0xFF;
info.length = 0;
info.ext.type = 0x2F;
info.ext.data = pos;
- pos = 0;
+ pos += 6;
break;
}
} else {
@@ -191,6 +193,7 @@
void MidiParser_EUP::resetTracking() {
MidiParser::resetTracking();
_presend = 1;
+ _base_tick = 0;
}
MidiParser *MidiParser_createEUP() { return new MidiParser_EUP; }
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/bs2 console.cpp,1.11,1.12 controls.cpp,1.19,1.20 debug.cpp,1.10,1.11 events.cpp,1.6,1.7 function.cpp,1.18,1.19 logic.cpp,1.15,1.16 logic.h,1.3,1.4 save_rest.cpp,1.19,1.20 speech.cpp,1.23,1.24 sword2.cpp,1.42,1.43
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.98,2.99 imuse_internal.h,2.24,2.25
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list