Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12e31b19 authored by Mike Lockwood's avatar Mike Lockwood
Browse files

MidiFramer: Support realtime messages contained within SysEx messages.

Also fix off by one error that occurred if a SysEx message ended
in the middle of the buffer being processed.

Change-Id: I055f005610c7b091012a30b306786114c5d9bf8d
parent f26b72dd
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public class MidiFramer extends MidiReceiver {
                        // Log.i(TAG, "SysEx End");
                        if (mInSysEx) {
                            mReceiver.sendWithTimestamp(data, sysExStartOffset,
                                offset - sysExStartOffset, timestamp);
                                offset - sysExStartOffset + 1, timestamp);
                            mInSysEx = false;
                            sysExStartOffset = -1;
                        }
@@ -90,6 +90,11 @@ public class MidiFramer extends MidiReceiver {
                    }
                } else { // real-time?
                    // Single byte message interleaved with other data.
                    if (mInSysEx) {
                        mReceiver.sendWithTimestamp(data, sysExStartOffset,
                                offset - sysExStartOffset, timestamp);
                        sysExStartOffset = offset + 1;
                    }
                    mReceiver.sendWithTimestamp(data, offset, 1, timestamp);
                }
            } else { // data byte
@@ -110,7 +115,7 @@ public class MidiFramer extends MidiReceiver {
        }

        // send any accumulatedSysEx data
        if (sysExStartOffset >= 0) {
        if (sysExStartOffset >= 0 && sysExStartOffset < offset) {
            mReceiver.sendWithTimestamp(data, sysExStartOffset,
                    offset - sysExStartOffset, timestamp);
        }