ngwese
25
Well if I’m running through things in my head correctly I think the following sequence is possible with two (or more) midi events in the rxBuf:
- status byte is found => packet.data[0]
- two data bytes found => packet.data[1] and packet.data[2]
- start of next incoming midi packet
- if midi packet header has CN value >= 0x8 then the header itself is interpreted as a status byte, the previous event is posted and all subsequent parsing is off by one byte
- if midi packet header has CN value < 0x8 then header byte itself => packet.data[3]
- if the next byte (which is the beginning of the actual payload for the next midi message) is a status byte then the previous event is posted with garbage in the LSB else the whole previous event is discarded because (dst > packetEnd)
…basically the first event will probably get posted, possibly with some garbage at the end. Subsequent events may be posted but are likely to be entirely corrupted.
I hope to have time tonight to test out an alternate version midi_parse along with one other tweak. If all goes well I’ll port over the changes to the aleph code base for testing.