From e8be47abb880a06090f36a7305ab0e4f59f0a701 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Fri, 14 Sep 2018 22:35:04 -0500 Subject: Add running status to mid2agb --- tools/mid2agb/midi.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools/mid2agb/midi.cpp') diff --git a/tools/mid2agb/midi.cpp b/tools/mid2agb/midi.cpp index ba5dd654a..7c05c5237 100644 --- a/tools/mid2agb/midi.cpp +++ b/tools/mid2agb/midi.cpp @@ -52,6 +52,7 @@ static std::int32_t s_absoluteTime; static int s_blockCount = 0; static int s_minNote; static int s_maxNote; +static int s_runningStatus = 0; void Seek(long offset) { @@ -181,19 +182,31 @@ void DetermineEventCategory(MidiEventCategory& category, int& typeChan, int& siz { typeChan = ReadInt8(); + if (typeChan < 0x80 && s_runningStatus != 0) + { + typeChan = s_runningStatus; + Skip(-1); + } + if (typeChan == 0xFF) { category = MidiEventCategory::Meta; size = 0; } + else if (typeChan >= 0xF8) + { + category = MidiEventCategory::Invalid; + } else if (typeChan >= 0xF0) { category = MidiEventCategory::SysEx; size = 0; + s_runningStatus = 0; } else if (typeChan >= 0x80) { category = MidiEventCategory::Control; + s_runningStatus = typeChan; switch (typeChan >> 4) { -- cgit v1.2.3