Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::midi::Parser Class Reference

MIDI byte stream parser — state machine with running status. More...

#include <parser.hpp>

Collaboration diagram for sbl::midi::Parser:

Public Member Functions

void set_callback (MidiCallback cb)
 Set the callback for parsed MIDI events.
 
void set_channel (uint8_t ch)
 Set channel filter.
 
void push (uint8_t byte)
 Feed one byte from UART RX.
 
void push (const uint8_t *data, uint16_t len)
 Feed multiple bytes.
 

Detailed Description

MIDI byte stream parser — state machine with running status.

Note
All public methods are ISR-safe — O(1) state machine with no hardware I/O. Callback is invoked synchronously from push().

Definition at line 35 of file parser.hpp.

Member Function Documentation

◆ push() [1/2]

void sbl::midi::Parser::push ( const uint8_t *  data,
uint16_t  len 
)
inline

Feed multiple bytes.

Note
ISR-safe — O(n) loop over push(), no blocking or I/O.

Definition at line 158 of file parser.hpp.

References push().

Here is the call graph for this function:

◆ push() [2/2]

void sbl::midi::Parser::push ( uint8_t  byte)
inline

Feed one byte from UART RX.

State machine processes the byte and dispatches complete messages via the callback. System Real-Time messages are dispatched immediately, even mid-message.

Note
ISR-safe — O(1) state machine, no blocking or I/O.

Definition at line 59 of file parser.hpp.

References sbl::midi::expected_data_bytes(), sbl::midi::TuneRequest, and sbl::midi::MidiEvent::type.

Referenced by sbl::midi::poll(), and push().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_callback()

void sbl::midi::Parser::set_callback ( MidiCallback  cb)
inline

Set the callback for parsed MIDI events.

Note
ISR-safe — stores a function pointer, no I/O.

Definition at line 41 of file parser.hpp.

◆ set_channel()

void sbl::midi::Parser::set_channel ( uint8_t  ch)
inline

Set channel filter.

Parameters
chChannel 0-15, or 0xFF for omni (receive all channels)
Note
ISR-safe — stores a byte, no I/O.

Definition at line 48 of file parser.hpp.


The documentation for this class was generated from the following file: