added support for receiving SysEx command segments
Very long SysEx mesaages are cut in to multiple command segments Where a normal SysEx starts with F0 and ends with F7, the first segment will start with F0 and end with F0, the middle section (optional) start with F7 and ends with F7 - the last segments starts with F7 and ends with F0
This commit is contained in:
parent
5fab6b3fc3
commit
0d596066b4
16
src/MIDI.hpp
16
src/MIDI.hpp
|
|
@ -795,12 +795,13 @@ bool MidiInterface<SerialPort, Settings>::parse()
|
|||
mPendingMessageExpectedLenght = 3;
|
||||
break;
|
||||
|
||||
case SystemExclusive:
|
||||
case SystemExclusiveStart:
|
||||
case SystemExclusiveEnd:
|
||||
// The message can be any lenght
|
||||
// between 3 and MidiMessage::sSysExMaxSize bytes
|
||||
mPendingMessageExpectedLenght = MidiMessage::sSysExMaxSize;
|
||||
mRunningStatus_RX = InvalidType;
|
||||
mMessage.sysexArray[0] = SystemExclusive;
|
||||
mMessage.sysexArray[0] = pendingType;
|
||||
break;
|
||||
|
||||
case InvalidType:
|
||||
|
|
@ -873,11 +874,13 @@ bool MidiInterface<SerialPort, Settings>::parse()
|
|||
return true;
|
||||
|
||||
// End of Exclusive
|
||||
case 0xf7:
|
||||
if (mMessage.sysexArray[0] == SystemExclusive)
|
||||
case SystemExclusiveStart:
|
||||
case SystemExclusiveEnd:
|
||||
if ((mMessage.sysexArray[0] == SystemExclusiveStart)
|
||||
|| (mMessage.sysexArray[0] == SystemExclusiveEnd))
|
||||
{
|
||||
// Store the last byte (EOX)
|
||||
mMessage.sysexArray[mPendingMessageIndex++] = 0xf7;
|
||||
mMessage.sysexArray[mPendingMessageIndex++] = extracted;
|
||||
mMessage.type = SystemExclusive;
|
||||
|
||||
// Get length
|
||||
|
|
@ -902,7 +905,8 @@ bool MidiInterface<SerialPort, Settings>::parse()
|
|||
}
|
||||
|
||||
// Add extracted data byte to pending message
|
||||
if (mPendingMessage[0] == SystemExclusive)
|
||||
if ((mPendingMessage[0] == SystemExclusiveStart)
|
||||
|| (mPendingMessage[0] == SystemExclusiveEnd))
|
||||
mMessage.sysexArray[mPendingMessageIndex] = extracted;
|
||||
else
|
||||
mPendingMessage[mPendingMessageIndex] = extracted;
|
||||
|
|
|
|||
|
|
@ -73,10 +73,12 @@ enum MidiType: uint8_t
|
|||
AfterTouchChannel = 0xD0, ///< Channel (monophonic) AfterTouch
|
||||
PitchBend = 0xE0, ///< Pitch Bend
|
||||
SystemExclusive = 0xF0, ///< System Exclusive
|
||||
SystemExclusiveStart = SystemExclusive, ///< System Exclusive Start
|
||||
TimeCodeQuarterFrame = 0xF1, ///< System Common - MIDI Time Code Quarter Frame
|
||||
SongPosition = 0xF2, ///< System Common - Song Position Pointer
|
||||
SongSelect = 0xF3, ///< System Common - Song Select
|
||||
TuneRequest = 0xF6, ///< System Common - Tune Request
|
||||
SystemExclusiveEnd = 0xF7, ///< System Exclusive End
|
||||
Clock = 0xF8, ///< System Real Time - Timing Clock
|
||||
Start = 0xFA, ///< System Real Time - Start
|
||||
Continue = 0xFB, ///< System Real Time - Continue
|
||||
|
|
|
|||
Loading…
Reference in New Issue