49 bool inFlipHeaderBits)
51 unsigned outLength = 0;
55 for (
unsigned i = 0; i < inLength; ++i)
57 const byte data = inData[i];
58 const byte msb = data >> 7;
59 const byte body = data & 0x7f;
61 outSysEx[0] |= (msb << (inFlipHeaderBits ? count : (6 - count)));
62 outSysEx[1 + count] = body;
72 return outLength + count + (count != 0 ? 1 : 0);
90 bool inFlipHeaderBits)
96 for (
unsigned i = 0; i < inLength; ++i)
100 msbStorage = inSysEx[i];
105 const byte body = inSysEx[i];
106 const byte shift = inFlipHeaderBits ? 6 - byteIndex : byteIndex;
107 const byte msb = byte(((msbStorage >> shift) & 1) << 7);
109 outData[count++] = msb | body;
BEGIN_MIDI_NAMESPACE unsigned encodeSysEx(const byte *inData, byte *outSysEx, unsigned inLength, bool inFlipHeaderBits)
Encode System Exclusive messages. SysEx messages are encoded to guarantee transmission of data bytes ...
unsigned decodeSysEx(const byte *inSysEx, byte *outData, unsigned inLength, bool inFlipHeaderBits)
Decode System Exclusive messages. SysEx messages are encoded to guarantee transmission of data bytes ...
MIDI Library for the Arduino.