Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
sbl::midi Namespace Reference

MIDI protocol support. More...

Classes

struct  MidiEvent
 
class  Parser
 MIDI byte stream parser — state machine with running status. More...
 

Typedefs

using MidiCallback = void(*)(const MidiEvent &event)
 Callback type for parsed MIDI events.
 

Enumerations

enum class  MessageType : uint8_t {
  NoteOff = 0x80 , NoteOn = 0x90 , PolyPressure = 0xA0 , ControlChange = 0xB0 ,
  ProgramChange = 0xC0 , ChannelPressure = 0xD0 , PitchBend = 0xE0 , Clock = 0xF8 ,
  Start = 0xFA , Continue = 0xFB , Stop = 0xFC , ActiveSensing = 0xFE ,
  SystemReset = 0xFF , SysEx = 0xF0 , SysExEnd = 0xF7 , TimeCode = 0xF1 ,
  SongPosition = 0xF2 , SongSelect = 0xF3 , TuneRequest = 0xF6 , None = 0x00
}
 

Functions

template<typename UartDriver >
void poll (Parser &parser)
 Poll UART for MIDI bytes and feed them to the parser.
 
uint8_t expected_data_bytes (uint8_t status)
 Number of data bytes expected for a channel message status byte.
 

Detailed Description

MIDI protocol support.

Stream-based MIDI parser with running status, real-time passthrough, SysEx handling, and channel filtering. Template-based input polling.

Typedef Documentation

◆ MidiCallback

using sbl::midi::MidiCallback = typedef void(*)(const MidiEvent& event)

Callback type for parsed MIDI events.

Definition at line 144 of file types.hpp.

Enumeration Type Documentation

◆ MessageType

enum class sbl::midi::MessageType : uint8_t
strong
Enumerator
NoteOff 
NoteOn 
PolyPressure 
ControlChange 
ProgramChange 
ChannelPressure 
PitchBend 
Clock 
Start 
Continue 
Stop 
ActiveSensing 
SystemReset 
SysEx 
SysExEnd 
TimeCode 
SongPosition 
SongSelect 
TuneRequest 
None 

Definition at line 11 of file types.hpp.

Function Documentation

◆ expected_data_bytes()

uint8_t sbl::midi::expected_data_bytes ( uint8_t  status)
inline

Number of data bytes expected for a channel message status byte.

Definition at line 147 of file types.hpp.

Referenced by sbl::midi::Parser::push().

Here is the caller graph for this function:

◆ poll()

template<typename UartDriver >
void sbl::midi::poll ( Parser parser)
inline

Poll UART for MIDI bytes and feed them to the parser.

Drains all available bytes from the UART RX buffer. Non-blocking — returns immediately if no data available.

Template Parameters
UartDriverUART driver class with available() and read_byte()
Note
ISR-safe — drains available bytes from ring buffer, no blocking.

Definition at line 29 of file input.hpp.

References sbl::midi::Parser::push().

Here is the call graph for this function: