Skip to content

fix: pass complete SysEx buffer instead of last chunk for multi-buffer messages#8

Open
thorinside wants to merge 1 commit into
InvisibleWrench:mainfrom
thorinside:fix/sysex-multi-buffer
Open

fix: pass complete SysEx buffer instead of last chunk for multi-buffer messages#8
thorinside wants to merge 1 commit into
InvisibleWrench:mainfrom
thorinside:fix/sysex-multi-buffer

Conversation

@thorinside
Copy link
Copy Markdown

Problem

Multi-buffer SysEx messages (large SysEx that spans more than one Windows MIDI buffer) are delivered incorrectly. When the final 0xF7 terminator arrives, handleSysexData is called with messageData (only the last chunk) instead of partialSysExBuffer (the complete assembled message).

This means any SysEx message that requires multiple WinMM MIDI header buffers is silently truncated to its last chunk, causing the receiver to see a corrupt/incomplete SysEx message.

Fix

// Before
dev?.handleSysexData(messageData, midiHdrPointer);

// After  
dev?.handleSysexData(Uint8List.fromList(partialSysExBuffer), midiHdrPointer);

Pass partialSysExBuffer (the fully assembled message) rather than messageData (the last chunk only). Clear the buffer afterwards as before.

Impact

Any app sending large SysEx messages on Windows — such as firmware updates, patch dumps, or bulk preset transfers — would receive corrupted data. This fix ensures the complete SysEx payload is delivered to the application.

Testing

Verified with large SysEx transfers (500+ byte preset dumps) via nt_helper on Windows. Before the fix, only the last WinMM buffer chunk was received; after the fix, the complete message is received correctly.

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.

1 participant