Support multi-packet sysex messages in JvmMidiAccess #53
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.
Multi-packet sysex messages are useful for controlling transmission speed. Additionally, JVM sometimes splits sysex messages into multiple packets.
As JavaDoc mentioned, the first sysex message starts with 0xF0 as usual, and additional sysex messages start with 0xF7. For example, if we want to split the following message into three packets:
It would be something like this:
This patch removes the leading 0xF7 when receive a sysex staring with 0xF7, and adds a 0xF7 before sending the sysex message if the message is an additional sysex message.
This patch might not functional correctly when sending multi-packet sysex messages on most JVM due to some bugs. The bugs are fixed in openjdk/jdk#16477 and openjdk/jdk#16399. Currently, the patch is confirmed to work with OpenJDK 22-ea+25 and above. Compatibilities with older versions are expected after the completion of backporting.