Skip to content

title: daisy::MidiHandler summary: Simple MIDI Handler Parses bytes from an input into valid MidiEvents. The MidiEvents fill a FIFO queue that the user can pop messages from.


daisy::MidiHandler

Module: LIBDAISY / HUMAN_INTERFACE / MIDI

Simple MIDI Handler Parses bytes from an input into valid MidiEvents. The MidiEvents fill a FIFO queue that the user can pop messages from. More...

#include <midi.h>

Public Classes

Name
struct Config

Public Functions

Name
MidiHandler()
~MidiHandler()
void Init(Config config)
void StartReceive()
void Listen()
bool HasEvents() const
MidiEvent PopEvent()
void SendMessage(uint8_t * bytes, size_t size)
void Parse(uint8_t byte)

Detailed Description

template <typename Transport >
class daisy::MidiHandler;

Simple MIDI Handler Parses bytes from an input into valid MidiEvents. The MidiEvents fill a FIFO queue that the user can pop messages from.

Author: shensley

Date: March 2020

Public Functions Documentation

function MidiHandler

inline MidiHandler()

function ~MidiHandler

inline ~MidiHandler()

function Init

inline void Init(
    Config config
)

Parameters:

  • config Configuration structure used to define specifics to the MIDI Handler.

Initializes the MidiHandler


function StartReceive

inline void StartReceive()

Starts listening on the selected input mode(s). MidiEvent Queue will begin to fill, and can be checked with HasEvents()


function Listen

inline void Listen()

Start listening


function HasEvents

inline bool HasEvents() const

Return: True if there are events to be handled, else false.

Checks if there are unhandled messages in the queue


function PopEvent

inline MidiEvent PopEvent()

Return: The event to be handled

Pops the oldest unhandled MidiEvent from the internal queue


function SendMessage

inline void SendMessage(
    uint8_t * bytes,
    size_t size
)

SendMessage Send raw bytes as message


function Parse

inline void Parse(
    uint8_t byte
)

Parameters:

  • byte MIDI byte to be parsed

Note: Normally application code won't need to use this method directly.

Feed in bytes to parser state machine from an external source. Populates internal FIFO queue with MIDI Messages.

---

Updated on 2024-01-03 at 19:41:01 +0000