Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
parser.hpp File Reference

MIDI byte stream parser. More...

Detailed Description

MIDI byte stream parser.

State machine that parses raw UART bytes into MidiEvent structs. Supports running status, System Real-Time passthrough mid-message, and Note On velocity 0 -> Note Off conversion.

SysEx is acknowledged (resets running status) but not buffered.

Inspired by MI stmlib/midi/midi.h (MIT license).

Usage:

parser.set_callback(on_midi_event);
parser.set_channel(0); // Channel 1 (0-indexed), or 0xFF for omni
// In main loop or UART RX ISR:
while (uart_available()) {
parser.push(uart_read_byte());
}
MIDI byte stream parser - state machine with running status.
Definition parser.hpp:41
void set_callback(MidiCallback cb)
Set the callback for parsed MIDI events.
Definition parser.hpp:47
void push(uint8_t byte)
Feed one byte from UART RX.
Definition parser.hpp:65
void set_channel(uint8_t ch)
Set channel filter.
Definition parser.hpp:54

Definition in file parser.hpp.

#include <cstdint>
#include <sbl/protocol/midi/types.hpp>

Go to the source code of this file.

Classes

class  sbl::midi::Parser
 MIDI byte stream parser - state machine with running status. More...
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::midi
 MIDI parser, encoder, SMF and sequencer.