summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2023-02-16 17:06:22 +0700
committerGitHub <[email protected]>2023-02-16 17:06:22 +0700
commit6b4838cb2f451441d63291774a8958090c3aa00d (patch)
tree26609b5d1d7e02ecbf1ddb5a4737441955b73686
parente3be8a0a15455ed1963a4e8575302d84293beadf (diff)
parentfde757711785670a005095454cc0b06129f8ae80 (diff)
Merge pull request #1910 from rppicomidi/fix-1909
Fix issue 1909
-rw-r--r--src/class/midi/midi_device.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/class/midi/midi_device.c b/src/class/midi/midi_device.c
index de41706e8..eb1a770dd 100644
--- a/src/class/midi/midi_device.c
+++ b/src/class/midi/midi_device.c
@@ -261,11 +261,11 @@ uint32_t tud_midi_n_stream_write(uint8_t itf, uint8_t cable_num, uint8_t const*
stream->buffer[1] = data;
// Check to see if we're still in a SysEx transmit.
- if ( stream->buffer[0] == MIDI_CIN_SYSEX_START )
+ if ( ((stream->buffer[0]) & 0xF) == MIDI_CIN_SYSEX_START )
{
if ( data == MIDI_STATUS_SYSEX_END )
{
- stream->buffer[0] = MIDI_CIN_SYSEX_END_1BYTE;
+ stream->buffer[0] = (uint8_t) ((cable_num << 4) | MIDI_CIN_SYSEX_END_1BYTE);
stream->total = 2;
}
else
@@ -308,6 +308,7 @@ uint32_t tud_midi_n_stream_write(uint8_t itf, uint8_t cable_num, uint8_t const*
stream->buffer[0] = MIDI_CIN_SYSEX_END_1BYTE;
stream->total = 2;
}
+ stream->buffer[0] |= (uint8_t)(cable_num << 4);
}
else
{
@@ -328,9 +329,9 @@ uint32_t tud_midi_n_stream_write(uint8_t itf, uint8_t cable_num, uint8_t const*
stream->index++;
// See if this byte ends a SysEx.
- if ( stream->buffer[0] == MIDI_CIN_SYSEX_START && data == MIDI_STATUS_SYSEX_END )
+ if ( (stream->buffer[0] & 0xF) == MIDI_CIN_SYSEX_START && data == MIDI_STATUS_SYSEX_END )
{
- stream->buffer[0] = MIDI_CIN_SYSEX_START + (stream->index - 1);
+ stream->buffer[0] = (uint8_t) ((cable_num << 4) | (MIDI_CIN_SYSEX_START + (stream->index - 1)));
stream->total = stream->index;
}
}