Class: MidiPacket
The MidiPacket class encapsulates a MIDI message, including its port, status, and data. It provides utility methods for creating, analyzing, and manipulating MIDI messages.
The source file for this class is located in os/framework/MidiPacket.h
Enumerationsβ
EMidiStatusβ
Represents MIDI message types. Includes various MIDI commands like NoteOn, NoteOff, and SysEx.
Values:
None: No status.NoteOff: Note Off event.NoteOn: Note On event.AfterTouch: Aftertouch event.ControlChange: Control Change event.ProgramChange: Program Change event.ChannelPressure: Channel Pressure event.PitchChange: Pitch Bend Change event.MTCQuarterFrame: MIDI Time Code Quarter Frame event.SongPosition: Song Position Pointer event.SongSelect: Song Select event.TuneRequest: Tune Request event.Sync: MIDI Sync event.Tick: MIDI Tick event.Start: MIDI Start event.Continue: MIDI Continue event.Stop: MIDI Stop event.ActiveSense: Active Sensing event.Reset: Reset event.SysExData: SysEx Data event.SysExEnd: SysEx End event.
EMidiPortIDβ
Represents MIDI port identifiers.
Values:
MIDI_PORT_EACH_CLASS: Default MIDI out mode, sends to the first port of each class.MIDI_PORT_ALL: Send to all ports.MIDI_PORT_USB: USB MIDI port.MIDI_PORT_PHYSICAL: Physical MIDI port.MIDI_PORT_BLUETOOTH: Bluetooth MIDI port.MIDI_PORT_WIRELESS: Wireless MIDI port.MIDI_PORT_RTP: Real-Time Protocol (RTP) MIDI port.MIDI_PORT_DEVICE_CUSTOM: Custom device MIDI port.MIDI_PORT_SYNTH: Synthesizer MIDI port.MIDI_PORT_INVALID: Invalid MIDI port.
Constructorsβ
Default Constructorβ
MidiPacket();
Creates an empty MIDI packet with MIDI_PORT_INVALID and no data.
From Statusβ
MidiPacket(EMidiStatus status, ...);
Creates a MIDI packet with a specified status and variable arguments for data.
Parameters:
status(EMidiStatus): The MIDI status type....: Additional arguments for MIDI data.
From Port and Statusβ
MidiPacket(uint16_t port, EMidiStatus status, ...);
Creates a MIDI packet with a specified port and status, and variable arguments for data.
Parameters:
port(uint16_t): MIDI port identifier.status(EMidiStatus): The MIDI status type....: Additional arguments for MIDI data.
From Raw Dataβ
MidiPacket(EMidiStatus status, uint16_t length, uint8_t* data);
MidiPacket(uint16_t port, EMidiStatus status, uint16_t length, uint8_t* data);
Creates a MIDI packet from raw data.
Parameters:
port(uint16_t): MIDI port identifier.status(EMidiStatus): The MIDI status type.length(uint16_t): Length of the data.data(uint8_t*): Pointer to the data array.
Data Alias Functionsβ
channelβ
uint8_t channel();
Gets the MIDI channel from the message.
Returns:
uint8_t: The channel number.
noteβ
uint8_t note();
Gets the MIDI note or controller value.
Returns:
uint8_t: The note value.
controllerβ
uint8_t controller();
Alias for note(). Useful for ProgramChange events.
Returns:
uint8_t: The controller value.
velocityβ
uint8_t velocity();
Gets the velocity or pressure value for the MIDI message.
Returns:
uint8_t: The velocity value.
valueβ
uint16_t value();
Gets the value associated with the MIDI message (e.g., pitch bend or control change).
Returns:
uint16_t: The value.
Member Functionsβ
Lengthβ
uint8_t Length();
Gets the length of the MIDI message based on its status.
Returns:
uint8_t: The length of the message.
SysExβ
bool SysEx();
Checks if the message is a SysEx message.
Returns:
bool:trueif the message is SysEx, otherwisefalse.
SysExStartβ
bool SysExStart();
Checks if the message is the start of a SysEx message.
Returns:
bool:trueif the message is a SysEx start, otherwisefalse.
Operatorsβ
Boolean Conversionβ
operator bool();
Checks if the MIDI packet has valid data.
Returns:
bool:trueif valid, otherwisefalse.
Comments