diff options
author | Chris Xiong <chirs241097@gmail.com> | 2021-01-07 01:05:12 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2021-01-07 01:05:12 +0800 |
commit | 51d627aa7a879d1840142fb53bc3dfbbf1696411 (patch) | |
tree | ad090602fd6e43ec05e0d721c2e819935efec9f7 | |
parent | c9b5661f702fca7196ce758399c006c682322584 (diff) | |
download | QMidiPlayer-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.hpp | 6 |
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 |