Skip to content

Class daisy::MidiHandler

template <typename Transport>

ClassList > daisy > MidiHandler

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

  • #include <midi.h>

Classes

Type Name
struct Config

Public Types

Type Name
typedef std::function< void(MidiEvent &)> MidiEventCallback

Public Functions

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

Detailed Description

Author:

shensley

Date:

March 2020

Public Types Documentation

typedef MidiEventCallback

using daisy::MidiHandler< Transport >::MidiEventCallback =  std::function<void(MidiEvent&)>;

Public Functions Documentation

function HasEvents

inline bool daisy::MidiHandler::HasEvents () const

Checks if there are unhandled messages in the queue

Returns:

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


function Init

inline void daisy::MidiHandler::Init (
    Config config
) 

Initializes the MidiHandler

Parameters:

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

function Listen

inline void daisy::MidiHandler::Listen () 

Start listening


function MidiHandler

inline daisy::MidiHandler::MidiHandler () 

function Parse

inline void daisy::MidiHandler::Parse (
    uint8_t byte
) 

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

Note:

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

Parameters:

  • byte MIDI byte to be parsed

function PopEvent

inline MidiEvent daisy::MidiHandler::PopEvent () 

Pops the oldest unhandled MidiEvent from the internal queue

Returns:

The event to be handled


function RxActive

inline bool daisy::MidiHandler::RxActive () 

function SendMessage

inline void daisy::MidiHandler::SendMessage (
    uint8_t * bytes,
    size_t size
) 

SendMessage Send raw bytes as message


function StartReceive

inline void daisy::MidiHandler::StartReceive () 

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


function StartReceiveRt

inline void daisy::MidiHandler::StartReceiveRt (
    MidiEventCallback callback_for_rt_messages
) 

Starts listening on the selected input mode(s). MidiEvent Queue will begin to fill, and can be checked with HasEvents() MIDI events of type SystemRealTime will be delivered synchronously by callback. All other events are on the queue


function ~MidiHandler

inline daisy::MidiHandler::~MidiHandler () 


The documentation for this class was generated from the following file external-docs/libDaisy/src/hid/midi.h