aboutsummaryrefslogtreecommitdiff
path: root/sound/midiparser_xmidi.cpp
diff options
context:
space:
mode:
authorJamieson Christian2003-05-18 14:50:10 +0000
committerJamieson Christian2003-05-18 14:50:10 +0000
commitad548faeb61419d117d8a409176844f8f085af4b (patch)
tree69bf97a1fd0194c64e0efea24165698aec58987b /sound/midiparser_xmidi.cpp
parentd9dd0c5300f0e03bc5c903068aefeaefd5189e95 (diff)
downloadscummvm-rg350-ad548faeb61419d117d8a409176844f8f085af4b.tar.gz
scummvm-rg350-ad548faeb61419d117d8a409176844f8f085af4b.tar.bz2
scummvm-rg350-ad548faeb61419d117d8a409176844f8f085af4b.zip
MIDI Meta event Tx for virtual MidiDriver's
svn-id: r7638
Diffstat (limited to 'sound/midiparser_xmidi.cpp')
-rw-r--r--sound/midiparser_xmidi.cpp34
1 files changed, 13 insertions, 21 deletions
diff --git a/sound/midiparser_xmidi.cpp b/sound/midiparser_xmidi.cpp
index 7ac705d3bb..cc165c854c 100644
--- a/sound/midiparser_xmidi.cpp
+++ b/sound/midiparser_xmidi.cpp
@@ -139,7 +139,6 @@ void MidiParser_XMIDI::onTimer() {
uint32 length;
int i;
NoteTimer *ptr;
- bool active_notes;
byte note;
byte vel;
uint32 note_length;
@@ -156,8 +155,6 @@ void MidiParser_XMIDI::onTimer() {
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 @@ void MidiParser_XMIDI::onTimer() {
_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 @@ void MidiParser_XMIDI::onTimer() {
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;
}
}