Revert "Add some workarounds to mid2agb from https://github.com/freshollie/sa2."

This reverts commit 1105344759.
This commit is contained in:
laqieer 2022-05-01 00:56:15 +08:00
parent 65ad23785c
commit ef859eceac
3 changed files with 3 additions and 38 deletions

View File

@ -433,33 +433,22 @@ void PrintAgbTrack(std::vector<Event>& events)
if (event.type == EventType::Note)
break;
if (IsVolumeEvent(event))
if (event.type == EventType::Controller && event.param1 == 0x07)
{
foundVolBeforeNote = true;
break;
}
}
// If we find this signature we need to print
// the keyshift after the volume event
bool needsKeyshiftWorkaround =
events[0].type == EventType::WholeNoteMark &&
IsVolumeEvent(events[1]);
if (!foundVolBeforeNote)
PrintByte("\tVOL , 127*%s_mvl/mxv", g_asmLabel.c_str());
if (!needsKeyshiftWorkaround) {
PrintByte("KEYSH , %s_key%+d", g_asmLabel.c_str(), 0);
}
PrintWait(g_initialWait);
PrintByte("KEYSH , %s_key%+d", g_asmLabel.c_str(), 0);
for (unsigned i = 0; events[i].type != EventType::EndOfTrack; i++)
{
// We are going to be hacky
// and modify the time value, so can't be const
Event& event = events[i];
std::int32_t eventTime = event.time;
const Event& event = events[i];
if (IsPatternBoundary(event.type))
{
@ -526,19 +515,7 @@ void PrintAgbTrack(std::vector<Event>& events)
PrintOp(event.time, "BEND ", "c_v%+d", event.param2 - 64);
break;
case EventType::Controller:
// Ensure that a wait value is not printed after the volume
// command
if (needsKeyshiftWorkaround && i == 1) {
event.time = 0;
}
PrintControllerOp(event);
// print the keyshift and any wait after we have written the volume value
if (needsKeyshiftWorkaround && i == 1) {
PrintByte("\tKEYSH , %s_key%+d", g_asmLabel.c_str(), 0);
PrintWait(eventTime);
event.time = eventTime;
}
break;
default:
PrintWait(event.time);

View File

@ -573,14 +573,6 @@ bool EventCompare(const Event& event1, const Event& event2)
unsigned event1Type = (unsigned)event1.type;
unsigned event2Type = (unsigned)event2.type;
// For some reason if there is a volume
// event and an instrument change event
// at the start, we need to ensure the volume event
// happens first
if (event1.type == EventType::InstrumentChange && IsVolumeEvent(event2) &&
event1.time == 0 && event2.time == 0)
return false;
if (event1.type == EventType::Note)
event1Type += event1.note;

View File

@ -84,8 +84,4 @@ inline bool IsPatternBoundary(EventType type)
return type == EventType::EndOfTrack || (int)type <= 0x17;
}
inline bool IsVolumeEvent(const Event& event) {
return event.type == EventType::Controller && event.param1 == 0x07;
}
#endif // MIDI_H