Fix MIDI System Exclusive parsing:

* F0 start bytes is not part of the content sprayed anymore
 * Realtime byte are now supported during a SysEx, as it's the only 
   event that could be interleaved between a SySEx F0 .... F7 sequence.
 * Orphelin SysEx F7 end byte is passed on *AS IS*.
 
Please test (no support midi port to do it myself).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33127 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2009-09-14 04:34:21 +00:00
parent bfa9be00c4
commit 96270089ee
+10 -13
View File
@@ -107,23 +107,21 @@ int32 MidiPortProducer::GetData()
return B_ERROR; return B_ERROR;
} }
if (haveSysEx) // System Exclusive if (haveSysEx) { // System Exclusive mode
{ if (next < 0x80) { // System Exclusive data byte
if (next < 0x80) // data byte
{
sysexBuf[sysexSize++] = next; sysexBuf[sysexSize++] = next;
if (sysexSize == sysexAlloc) if (sysexSize == sysexAlloc) {
{
sysexAlloc *= 2; sysexAlloc *= 2;
sysexBuf = (uint8*) realloc(sysexBuf, sysexAlloc); sysexBuf = (uint8*) realloc(sysexBuf, sysexAlloc);
} }
continue; } else if (next == B_SYS_EX_END) {
}
else if (next < 0xF8) // end of sysex
{
SpraySystemExclusive(sysexBuf, sysexSize); SpraySystemExclusive(sysexBuf, sysexSize);
haveSysEx = false; haveSysEx = false;
} else if ((next & 0xF8) == 0xF8) {
// System Realtime interleaved in System Exclusive byte(s)
SpraySystemRealTime(next);
} }
continue;
} }
if ((next & 0xF8) == 0xF8) // System Realtime if ((next & 0xF8) == 0xF8) // System Realtime
@@ -140,8 +138,7 @@ int32 MidiPortProducer::GetData()
case B_SYS_EX_START: case B_SYS_EX_START:
sysexAlloc = 4096; sysexAlloc = 4096;
sysexBuf = (uint8*) malloc(sysexAlloc); sysexBuf = (uint8*) malloc(sysexAlloc);
sysexBuf[0] = next; sysexSize = 0;
sysexSize = 1;
haveSysEx = true; haveSysEx = true;
break; break;
@@ -158,7 +155,7 @@ int32 MidiPortProducer::GetData()
break; break;
case B_TUNE_REQUEST: case B_TUNE_REQUEST:
case B_SYS_EX_END: case B_SYS_EX_END: // Unpaired with B_SYS_EX_START, but pass it anyway...
SpraySystemCommon(next, 0, 0); SpraySystemCommon(next, 0, 0);
break; break;
} }