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

Parses a raw stream of uint32_t holding a series of Universal MIDI Packets using the MIDI 1.0 Protocol, converting to plain (non-UMP) MidiMessages. More...

Public Member Functions

 Midi1ToBytestreamTranslator (int initialBufferSize)
 Ensures that there is room in the internal buffer for a sysex message of at least initialBufferSize bytes. More...
 
void reset ()
 Clears the concatenator. More...
 
template<typename MessageCallback >
void dispatch (const View &packet, double time, MessageCallback &&callback)
 Converts a Universal MIDI Packet using the MIDI 1.0 Protocol to an equivalent MidiMessage. More...
 

Static Public Member Functions

static MidiMessage fromUmp (const PacketX1 &m, double time=0)
 Converts from a Universal MIDI Packet to MIDI 1 bytestream format. More...
 

Detailed Description

Parses a raw stream of uint32_t holding a series of Universal MIDI Packets using the MIDI 1.0 Protocol, converting to plain (non-UMP) MidiMessages.

Constructor & Destructor Documentation

◆ Midi1ToBytestreamTranslator()

universal_midi_packets::Midi1ToBytestreamTranslator::Midi1ToBytestreamTranslator ( int  initialBufferSize)
explicit

Ensures that there is room in the internal buffer for a sysex message of at least initialBufferSize bytes.

Member Function Documentation

◆ reset()

void universal_midi_packets::Midi1ToBytestreamTranslator::reset ( )

Clears the concatenator.

Referenced by universal_midi_packets::ToBytestreamConverter::reset().

◆ dispatch()

template<typename MessageCallback >
void universal_midi_packets::Midi1ToBytestreamTranslator::dispatch ( const View packet,
double  time,
MessageCallback &&  callback 
)

Converts a Universal MIDI Packet using the MIDI 1.0 Protocol to an equivalent MidiMessage.

Accumulates SysEx packets into a single MidiMessage, as appropriate.

Parameters
packeta packet which is using the MIDI 1.0 Protocol.
timethe timestamp to be applied to these messages.
callbacka callback which will be called with each converted MidiMessage.

◆ fromUmp()

static MidiMessage universal_midi_packets::Midi1ToBytestreamTranslator::fromUmp ( const PacketX1 m,
double  time = 0 
)
static

Converts from a Universal MIDI Packet to MIDI 1 bytestream format.

This is only capable of converting a single Universal MIDI Packet to an equivalent bytestream MIDI message. This function cannot understand multi-packet messages, like SysEx7 messages.

To convert multi-packet messages, use Midi1ToBytestreamTranslator to convert from a UMP MIDI 1.0 stream, or ToBytestreamDispatcher to convert from both MIDI 2.0 and MIDI 1.0.


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