From 51d627aa7a879d1840142fb53bc3dfbbf1696411 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Thu, 7 Jan 2021 01:05:12 +0800 Subject: 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. --- include/qmpcorepublic.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3