From 0bb92662d3affbbd7eea0e1033cb9971bf1cfab6 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 26 Apr 2008 17:12:37 +0000 Subject: [PATCH] - Fixed: Any MIDI ticks that contain only events that are interpreted by the MIDI parser and not passed on to the MIDI device would mess up timing for future events. SVN r945 (trunk) --- docs/rh-log.txt | 3 +++ src/sound/music_midi_midiout.cpp | 30 ++++++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 4809fc581..93fcc0be8 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ April 26, 2008 +- Fixed: Any MIDI ticks that contain only events that are interpreted by + the MIDI parser and not passed on to the MIDI device would mess up timing + for future events. - Changed EMIDI controller 110-113 handling to more accurately match the EMIDI specs: Track designations and exclusions should be ignored past the initial beat, and EMIDI program change and volume events should be diff --git a/src/sound/music_midi_midiout.cpp b/src/sound/music_midi_midiout.cpp index 204b765fd..d91a18ae0 100644 --- a/src/sound/music_midi_midiout.cpp +++ b/src/sound/music_midi_midiout.cpp @@ -456,12 +456,13 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay) if (data2 == 127) { track->Designation = ~0; + track->Designated = true; } else if (data2 <= 9) { track->Designation |= 1 << data2; + track->Designated = true; } - track->Designated = true; event = MIDI_META; } break; @@ -503,7 +504,7 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay) track->LoopDelay = 0; track->LoopCount = data2; track->LoopFinished = track->Finished; - event = 0xFF; + event = MIDI_META; break; case 117: // EMIDI Loop End @@ -524,7 +525,7 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay) track->Finished = track->LoopFinished; } } - event = 0xFF; + event = MIDI_META; break; case 118: // EMIDI Global Loop Begin @@ -535,7 +536,7 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay) Tracks[i].LoopCount = data2; Tracks[i].LoopFinished = Tracks[i].Finished; } - event = 0xFF; + event = MIDI_META; break; case 119: // EMIDI Global Loop End @@ -566,20 +567,17 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay) break; } } - if (event != MIDI_META) + events[0] = delay; + events[1] = 0; + if (event != MIDI_META && (!track->Designated || (track->Designation & DesignationMask))) { - events[0] = delay; - events[1] = 0; - if (!track->Designated || (track->Designation & DesignationMask)) - { - events[2] = event | (data1<<8) | (data2<<16); - } - else - { - events[2] = MEVT_NOP; - } - events += 3; + events[2] = event | (data1<<8) | (data2<<16); } + else + { + events[2] = MEVT_NOP; + } + events += 3; } else {