Skip to content

SysEx parse error #16

@franky47

Description

@franky47

SourceForge reference: https://sourceforge.net/p/arduinomidilib/bugs/11/

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).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions