@@ -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
229233parserReturn 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 (" \n end SysEx" );
240254 return parserReturn::Processed;
255+ }
241256 else if (octet == MIDI_NAMESPACE::MidiType::SystemExclusiveStart) // Start
257+ {
258+ Serial.println (" \n restart 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