MIDI: set minimum sysex delay when enabled #4513
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What issue(s) does this PR address?
Fixes #4506.
Does this PR introduce new feature(s)?
No
Does this PR introduce any breaking change(s)?
No
Additional information
A real rev.0 MT-32 is the main system that needs the sysex delay, and it needs about 40ms between sysex commands to work properly. 40ms is documented in a few blogs online and is the delay used universally by ScummVM. In testing, a sub-40 value appeared to work sometimes but always using 40 should be safest.
Reviewing the original delaysysex patch, the case that's leading to incorrect timing here is a new case in the if statement that wasn't in the original patch. It's possible this bug was introduced later, or that the patch as merged wasn't entirely comprehensive enough.
Tested with MEdit, which was written for LAPC-I/CL-32L; with this patch, loading problematic songs (such as One Step Beyond's
INGAME1.RLD
) now works, whereas they reliably triggered a buffer overflow before.