-
Notifications
You must be signed in to change notification settings - Fork 274
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
Allow large SysEx Messages to be broken up into smaller packets when transmitted #337
Merged
garyscavone
merged 2 commits into
thestk:master
from
insolace:KMI_Remove_SysEx_Format_Checks
Apr 18, 2024
Merged
Allow large SysEx Messages to be broken up into smaller packets when transmitted #337
garyscavone
merged 2 commits into
thestk:master
from
insolace:KMI_Remove_SysEx_Format_Checks
Apr 18, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… large payloads into smaller chunks.
…ecking for SysEx Start Message (RtMIDI should handle transport, it should not police message formatting)
Below is an example of how we parse our midi transmit buffer using this PR, breaking up standard messages and sysex into appropriately sized chunks.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We have found that older/slower systems can choke when sending large (> 100k) SysEx firmware payloads to our devices, which can cause problems with devices out in the field. To make our end user device firmware update process safer, we need to be able to slow down the transmission of these payloads and break them into smaller chunks.
Currently both the MacOS and Windows sendMessage methods check to see if the first byte is a SysEx start byte (0xF0) before allowing a > 3 byte message to be sent. If the first byte is not 0xF0, an error message is returned and the message is rejected. This not only inhibits our ability to break up the SysEx payload, it seems antithetical to RtMIDI's role as an agnostic transport that does not parse or format messages. It should be up to the application to determine if messages are formatted correctly, RtMIDI should just send and receive data.
This PR removes the blocking 0xF0 check on MacOS entirely. RtMIDI has not used the CoreMIDI sysex specific message method for years, and the standard send is still perfectly fine for this purpose.
On Windows, we've replaced the 0xF0 check with a size check - messages >3 bytes use the sysex method, otherwise the standard channel/realtime method is used.
The Alsa/Jack send methods do not have a 0xF0 check, so we did not modify them.
We've extensively tested this PR with whole and broken up SysEx payloads, on Windows and MacOS, with newer and older machines. This solved the issues we were having sending firmware updates.