Skip to content

Commit 8b5c815

Browse files
committed
Update rtpMIDI_Parser_CommandSection.hpp
1 parent d42ebc8 commit 8b5c815

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/rtpMIDI_Parser_CommandSection.hpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ parserReturn decodeMidi(RtpBuffer_t &buffer, uint8_t &runningstatus, size_t &con
198198
{
199199
case MIDI_NAMESPACE::MidiType::SystemExclusiveStart:
200200
case MIDI_NAMESPACE::MidiType::SystemExclusiveEnd:
201-
consumed = decodeMidiSysEx(buffer, consumed);
202-
// if (consumed > buffer.max_size())
203-
// return consumed;
201+
decodeMidiSysEx(buffer, consumed);
204202
break;
205203
case MIDI_NAMESPACE::MidiType::TimeCodeQuarterFrame:
206204
consumed += 1;
@@ -215,9 +213,15 @@ parserReturn decodeMidi(RtpBuffer_t &buffer, uint8_t &runningstatus, size_t &con
215213
break;
216214
}
217215

216+
Serial.print("consumed: ");
217+
Serial.println(consumed);
218+
Serial.print("buffer.size(): ");
219+
Serial.println(buffer.size());
220+
218221
if (buffer.size() < consumed)
219222
return parserReturn::NotEnoughData;
220223

224+
Serial.println("expose");
221225
session->StartReceivedMidi();
222226
for (size_t j = 0; j < consumed; j++)
223227
session->ReceivedMidi(buffer[j]);
@@ -228,20 +232,35 @@ parserReturn decodeMidi(RtpBuffer_t &buffer, uint8_t &runningstatus, size_t &con
228232

229233
parserReturn decodeMidiSysEx(RtpBuffer_t &buffer, size_t &consumed)
230234
{
231-
consumed = 1; // beginning SysEx Token is not counted (as it could remain)
235+
Serial.print("buffer.size(): ");
236+
Serial.println(buffer.size());
237+
Serial.println("Start SysEx");
238+
239+
// consumed = 1; // beginning SysEx Token is not counted (as it could remain)
232240
size_t i = 0;
233241
auto octet = buffer[++i];
234242

235243
while (i < buffer.size())
236244
{
237245
consumed++;
238246
octet = buffer[i++];
247+
248+
Serial.print(" 0x");
249+
Serial.print(octet, HEX);
250+
239251
if (octet == MIDI_NAMESPACE::MidiType::SystemExclusiveEnd) // Complete message
252+
{
253+
Serial.println("\nend SysEx");
240254
return parserReturn::Processed;
255+
}
241256
else if (octet == MIDI_NAMESPACE::MidiType::SystemExclusiveStart) // Start
257+
{
258+
Serial.println("\nrestart SysEx ???");
242259
return parserReturn::Processed;
260+
}
243261
}
244-
262+
263+
245264
// begin of the SysEx is found, not the end.
246265
// so transmit what we have, add a stop-token at the end,
247266
// remove the byes, modify the length and indicate

0 commit comments

Comments
 (0)