SystemExclusive messages should end with 0x7F byte and You included this in your code, but in wrong place. Now You have code like this:
00641 // First, test if this is a status byte
00642 if (extracted >= 0x80) {
...
00674 case 0xF7:
00675 if (getTypeFromStatusByte(mPendingMessage[0]) ==
SystemExclusive) {
...
You have tested extracted to be more or equal to 0x80 and than expect, that it will be less (0x7F < 0x80). So that is an error.
So code should look like this:
00638 }
00639 else {
if((extracted == 0xF7) && (getTypeFromStatusByte(mPendingMessage[0])
== SystemExclusive) && (mPendingMessageIndex>=3))
{
// Store System Exclusive array in midimsg structure
for (byte i=0;i<mPendingMessageIndex;i++) {
mMessage.sysex_array[i] = mPendingMessage[i];
}
mMessage.type = SystemExclusive;
// Get length
mMessage.data1 = (mPendingMessageIndex) & 0xFF;
mMessage.data2 = (mPendingMessageIndex) >> 8;
mMessage.channel = 0;
mMessage.valid = true;
reset_input_attributes();
return true;
}
00641 // First, test if this is a status byte
00642 if (extracted >= 0x80) {
Last byte is not stored, because it's not a data byte, but EOX (EndOfExclusive).
There is patched version of file in attachment
Patched file
Hello,
I moved this ticket to GitHub, here's the new address:
https://github.com/FortySevenEffects/arduino_midi_library/issues/16
Best regards,
Francois.