6#define USB_MIDI_NUMBER_OF_CABLES MIDI_NUM_CABLES
7#elif defined(USB_MIDI4_SERIAL) || defined(USB_MIDI4)
8#define USB_MIDI_NUMBER_OF_CABLES 4
9#elif defined(USB_MIDI16_AUDIO_SERIAL) || defined(USB_MIDI16_SERIAL) || \
12#define USB_MIDI_NUMBER_OF_CABLES 16
13#elif defined(ARDUINO_ARCH_RP2040)
14#define USB_MIDI_NUMBER_OF_CABLES 16
15#elif !defined(ARDUINO) || defined(DOXYGEN)
16#define USB_MIDI_NUMBER_OF_CABLES 16
18#define USB_MIDI_NUMBER_OF_CABLES 1
40 template <
class BytePuller>
65 template <u
int8_t NumBytes>
106template <
class BytePuller>
118 while (puller.pull(midiPacket)) {
119 evt =
feed(midiPacket);
MIDIReadEvent
Values returned by the MIDI reading functions.
@ NO_MESSAGE
No new messages were received.
#define BEGIN_CS_NAMESPACE
#define USB_MIDI_NUMBER_OF_CABLES
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
A type-safe class for MIDI USB Cable numbers.
constexpr uint8_t getRaw() const
Get the cable as an integer.
Base class for MIDI parsers.
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.
bool isReceiving() const
Check if the buffer is receiving a SysEx message.
Parser for MIDI over USB packets.
bool hasSysExSpace(Cable cable, uint8_t amount) const
MIDIReadEvent handleSingleByte(MIDIUSBPacket_t packet, Cable cable)
MIDIReadEvent resume()
Resume the parser with the previously stored and unhandled packet.
SysExBuffer sysexbuffers[16]
MIDIReadEvent handleSysExStartCont(MIDIUSBPacket_t packet, Cable cable)
void endSysExChunk(Cable cable)
void storePacket(MIDIUSBPacket_t packet)
MIDIReadEvent handleSysExEnd(MIDIUSBPacket_t packet, Cable cable)
MIDIReadEvent handleChannelMessage(MIDIUSBPacket_t packet, Cable cable)
void startSysEx(Cable cable)
bool receivingSysEx(Cable cable) const
bool hasStoredPacket() const
MIDIUSBPacket_t storedPacket
MIDIUSBPacket_t popStoredPacket()
MIDIReadEvent feed(MIDIUSBPacket_t packet)
Feed a new packet to the parser.
MIDIReadEvent pull(BytePuller &&puller)
Parse one incoming MIDI message.
void addSysExByte(Cable cable, uint8_t data)
void endSysEx(Cable cable)
void addSysExBytes(Cable cable, const uint8_t *data, uint8_t len)
MIDIReadEvent handleSysCommon(MIDIUSBPacket_t packet, Cable cable)
SysExMessage getSysExMessage() const
Get the latest SysEx message.
AH::Array< uint8_t, 4 > MIDIUSBPacket_t