Public Member Functions | List of all members
universal_midi_packets::BytestreamToUMPDispatcher Class Reference

Parses a stream of bytes representing a sequence of bytestream-encoded MIDI 1.0 messages, converting the messages to UMP format and passing the packets to a user-provided callback as they become ready. More...

Public Member Functions

 BytestreamToUMPDispatcher (PacketProtocol pp, int storageSize)
 Initialises the dispatcher. More...
 
void reset ()
 
template<typename PacketCallbackFunction >
void dispatch (const uint8_t *begin, const uint8_t *end, double timestamp, PacketCallbackFunction &&callback)
 Calls callback with a View of each converted packet as it becomes ready. More...
 

Detailed Description

Parses a stream of bytes representing a sequence of bytestream-encoded MIDI 1.0 messages, converting the messages to UMP format and passing the packets to a user-provided callback as they become ready.

Constructor & Destructor Documentation

◆ BytestreamToUMPDispatcher()

universal_midi_packets::BytestreamToUMPDispatcher::BytestreamToUMPDispatcher ( PacketProtocol  pp,
int  storageSize 
)
explicit

Initialises the dispatcher.

Channel messages will be converted to the requested protocol format pp. storageSize bytes will be allocated to store incomplete messages.

Member Function Documentation

◆ reset()

void universal_midi_packets::BytestreamToUMPDispatcher::reset ( )

◆ dispatch()

template<typename PacketCallbackFunction >
void universal_midi_packets::BytestreamToUMPDispatcher::dispatch ( const uint8_t *  begin,
const uint8_t *  end,
double  timestamp,
PacketCallbackFunction &&  callback 
)

Calls callback with a View of each converted packet as it becomes ready.

Parameters
beginthe first byte in a range of bytes representing bytestream-encoded MIDI messages.
endone-past the last byte in a range of bytes representing bytestream-encoded MIDI messages.
timestampa timestamp to apply to the created packets.
callbacka callback which will be passed a View pointing to each new packet as it becomes ready.

References begin(), end(), and universal_midi_packets::Conversion::toMidi1().


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