summaryrefslogtreecommitdiff
path: root/tools/mid2agb/midi.cpp
diff options
context:
space:
mode:
authorgarak <garakmon@gmail.com>2018-10-19 16:05:14 -0400
committergarak <garakmon@gmail.com>2018-10-19 16:05:14 -0400
commit38fcc46abb36df72512f4b532d1379dab1c13af6 (patch)
treedf44258d7b5a65d2a75a146c7c01b6c683b023f9 /tools/mid2agb/midi.cpp
parent901f3ff55715ec6bdeda5c711e7e73b4c38ab55a (diff)
parent95d8815721321f08714b97c59a97de3a59f1e0c7 (diff)
Merge remote-tracking branch 'upstream/master' into pan-constants
Diffstat (limited to 'tools/mid2agb/midi.cpp')
-rw-r--r--tools/mid2agb/midi.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/mid2agb/midi.cpp b/tools/mid2agb/midi.cpp
index c7a4389b9..fa7d9ce28 100644
--- a/tools/mid2agb/midi.cpp
+++ b/tools/mid2agb/midi.cpp
@@ -780,7 +780,7 @@ int CalculateCompressionScore(std::vector<Event>& events, int index)
std::uint8_t lastVelocity = 0x80u;
EventType lastType = events[index].type;
std::int32_t lastDuration = 0x80000000;
- std::uint8_t lastNote = 0x80u;
+ std::uint8_t lastNote = 0x40u;
if (events[index].time > 0)
score++;
@@ -844,7 +844,7 @@ int CalculateCompressionScore(std::vector<Event>& events, int index)
lastType = events[i].type;
if (events[i].time)
- ++score;
+ score++;
}
return score;
@@ -852,6 +852,12 @@ int CalculateCompressionScore(std::vector<Event>& events, int index)
bool IsCompressionMatch(std::vector<Event>& events, int index1, int index2)
{
+ if (events[index1].type != events[index2].type ||
+ events[index1].note != events[index2].note ||
+ events[index1].param1 != events[index2].param1 ||
+ events[index1].time != events[index2].time)
+ return false;
+
index1++;
index2++;
@@ -900,7 +906,7 @@ void Compress(std::vector<Event>& events)
return;
}
- if (CalculateCompressionScore(events, i) > 6)
+ if (CalculateCompressionScore(events, i) >= 6)
{
CompressWholeNote(events, i);
}