From 1bb8873e3077b80051be59afbaf1dc4c52ce574a Mon Sep 17 00:00:00 2001 From: Yikai Liao Date: Thu, 21 Dec 2023 20:36:18 +0800 Subject: [PATCH] fifo --- 3rdparty/minimidi | 2 +- include/Score.hpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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