#11 SystemExclusive parse error

version 3.0
closed
nobody
Input (6)
5
2014-04-20
2012-08-23
$an4e$
No

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

Discussion

  • $an4e$
    $an4e$
    2012-08-23

    Patched file

     
    Attachments
  • Francois BEST
    Francois BEST
    2014-04-20

    • status: open --> closed
    • Group: --> version 3.0