aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2021-01-07 01:05:12 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2021-01-07 01:05:12 +0800
commit51d627aa7a879d1840142fb53bc3dfbbf1696411 (patch)
treead090602fd6e43ec05e0d721c2e819935efec9f7
parentc9b5661f702fca7196ce758399c006c682322584 (diff)
downloadQMidiPlayer-51d627aa7a879d1840142fb53bc3dfbbf1696411.tar.xz
Stupid sequencer puts reset messages after channel setup messages.
This is only a workaround. These midi files should be seen as ill-formed. This patch puts any sysex messages ahead of other messages that have the same time stamp.
-rw-r--r--include/qmpcorepublic.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/qmpcorepublic.hpp b/include/qmpcorepublic.hpp
index 242ca58..3c72ad9 100644
--- a/include/qmpcorepublic.hpp
+++ b/include/qmpcorepublic.hpp
@@ -39,7 +39,11 @@ struct SEvent
iid(_iid), time(_t), type(_tp), p1(_p1), p2(_p2), str(s) {}
friend bool operator <(const SEvent &a, const SEvent &b)
{
- return a.time - b.time ? a.time < b.time : a.iid < b.iid;
+ if (a.time != b.time)
+ return a.time < b.time;
+ else if ((a.type == 0xF0) ^ (b.type == 0xF0))
+ return (a.type == 0xF0) > (b.type == 0xF0);
+ else return a.iid < b.iid;
}
};
//MIDI Track class