diff --git a/3rdparty/minimidi b/3rdparty/minimidi index bbfaa93..2a153ce 160000 --- a/3rdparty/minimidi +++ b/3rdparty/minimidi @@ -1 +1 @@ -Subproject commit bbfaa93630f77863d8ff4d806ee171d2d2ca75ed +Subproject commit 2a153ce4d0b65cdd6990e5b3ec8cc2b69ee5fb44 diff --git a/include/Score.hpp b/include/Score.hpp index 6c322f7..46af69d 100644 --- a/include/Score.hpp +++ b/include/Score.hpp @@ -1489,7 +1489,13 @@ minimidi::file::MidiFile Score::to_midi() const { )); } // add notes - for(const auto ¬e: track.notes) { + vec> notes {track.notes}; + pdqsort_branchless(notes.begin(), notes.end(), [](const Note &a, const Note &b) { + if (a.time != b.time) return (a.time) < (b.time); + return a.duration < b.duration; + }); + + for(const auto ¬e: notes) { msgs.emplace_back(message::Message::NoteOn( this->convert_ttype(note.time), channel, note.pitch, note.velocity