26 template <
class BytePuller>
93template <
class BytePuller>
105 while (puller.pull(midiByte)) {
106 evt =
feed(midiByte);
MIDIReadEvent
Values returned by the MIDI reading functions.
@ NO_MESSAGE
No new messages were received.
#define BEGIN_CS_NAMESPACE
Base class for MIDI parsers.
Parser for Serial MIDI streams (and BLE-MIDI).
MIDIReadEvent resume()
Resume the parser with the previously stored and unhandled byte.
SerialMIDI_Parser(bool sysCommonCancelsRunningStatus=true)
bool sysCommonCancelsRunningStatus
Accounts for running status differences between MIDI 1.0 and BLE-MIDI.
uint8_t currentHeader
Current header (not necessarily running), contains the header of the message that's currently being r...
MIDIReadEvent handleNonRealTimeStatus(uint8_t midiByte)
MIDIReadEvent handleRealTime(uint8_t midiByte)
uint8_t runningHeader
Running status header.
bool hasStoredByte() const
Check whether there's a stored byte.
uint8_t popStoredByte()
Get the stored byte. Afterwards, hasStoredByte will return false.
MIDIReadEvent pull(BytePuller &&puller)
Parse one incoming MIDI message.
MIDIReadEvent feed(uint8_t midibyte)
Feed a new byte to the parser.
void storeByte(uint8_t midiByte)
Store a byte to parse later.
MIDIReadEvent handleData(uint8_t midiByte)
SysExMessage getSysExMessage() const
Get the latest SysEx message.
bool thirdByte
Flag that remembers that the next data byte will be the third byte of a message.
bool hasSysExSpace() const
void addSysExByte(uint8_t data)
void cancelRunningStatus()
Clear the running status header for MIDI Channel messages.
MIDIReadEvent handleStatus(uint8_t midiByte)
Helper for storing the System Exclusive messages being received by a MIDI parser.
const uint8_t * getBuffer() const
Get a pointer to the buffer.
bool hasSpaceLeft(uint8_t amount=1) const
Check if the buffer has at least amount bytes of free space available.
void start()
Start a new SysEx message.
void add(uint8_t data)
Add a byte to the current SysEx message.
void end()
Finish the current SysEx message.
uint16_t getLength() const
Get the length of the SysEx message in the buffer.