Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-packet sysex messages in JvmMidiAccess #53

Merged
merged 1 commit into from
Dec 9, 2023

Conversation

AlecJY
Copy link
Contributor

@AlecJY AlecJY commented Dec 8, 2023

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:

0xF0 0x7D 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0xF7

It would be something like this:

0xF0 0x7D 0x01 0x02
0xF7 0x03 0x04
0xF7 0x05 0x06 0xF7

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.

@atsushieno
Copy link
Owner

Thanks, that's very helpful to whoever wants solid sysex support (who doesn't) !

@atsushieno atsushieno merged commit 9d65e12 into atsushieno:main Dec 9, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants