Struct MidiMessage
- Namespace
- SpessaSharp.MIDI
- Assembly
- SpessaSharp.dll
Contains enums for midi events and controllers and functions to parse them
public readonly record struct MidiMessage : IEquatable<MidiMessage>
- Implements
- Inherited Members
Constructors
MidiMessage(int, StatusByte, ArraySegment<byte>)
Contains enums for midi events and controllers and functions to parse them
public MidiMessage(int Ticks, StatusByte StatusByte, ArraySegment<byte> Data)
Parameters
TicksintAbsolute number of MIDI ticks from the start of the track.
StatusByteStatusByteThe MIDI message status byte. Note that for meta events, it is the second byte. (not 0xFF).
DataArraySegment<byte>Message's binary data.
Properties
Data
Message's binary data.
public ArraySegment<byte> Data { get; init; }
Property Value
StatusByte
The MIDI message status byte. Note that for meta events, it is the second byte. (not 0xFF).
public StatusByte StatusByte { get; init; }
Property Value
Ticks
Absolute number of MIDI ticks from the start of the track.
public int Ticks { get; init; }
Property Value
Methods
ChannelPressure(int, int, int)
Returns a new MIDI Channel Pressure message.
public static MidiMessage ChannelPressure(int ticks, int channel, int value)
Parameters
ticksintTime of this message in absolute MIDI ticks.
channelintThe channel number of this message.
valueintThe new value, between 0 and 127.
Returns
ControllerChange(int, int, CC, int)
Returns a new MIDI Controller Change message.
public static MidiMessage ControllerChange(int ticks, int channel, Midi.CC controller, int value)
Parameters
ticksintTime of this message in absolute MIDI ticks.
channelintThe channel number of this message.
controllerMidi.CCThe MIDI controller.
valueintThe new value.
Returns
GetTempo()
public double GetTempo()
Returns
ID(Type)
public static int ID(MidiMessage.Type type)
Parameters
typeMidiMessage.Type
Returns
PitchWheel(int, int, int)
Returns a new MIDI Pitch Wheel message.
public static MidiMessage PitchWheel(int ticks, int channel, int value)
Parameters
ticksintTime of this message in absolute MIDI ticks.
channelintThe channel number of this message.
valueintThe new value, between 0 and 16_383, where 8_192 is the center (no pitch change).
Returns
ProgramChange(int, int, int)
Returns a new MIDI Program Change message.
public static MidiMessage ProgramChange(int ticks, int channel, int program)
Parameters
ticksintTime of this message in absolute MIDI ticks.
channelintThe channel number of this message.
programintThe new MIDI program number, between 0 and 127.
Returns
RegisteredParameter(int, int, int, int)
Returns a new MIDI Registered Parameter message. Sends both data MSB and LSB.
public static MidiMessage[] RegisteredParameter(int ticks, int channel, int parameter, int value)
Parameters
ticksintTime of this message in absolute MIDI ticks.
channelintThe channel number of this message.
parameterintThe 14-bit MIDI registered parameter number.
valueintThe 14-bit new value.
Returns
SystemExclusive(int, ReadOnlySpan<byte>)
Returns a new MIDI System Exclusive message.
public static MidiMessage SystemExclusive(int ticks, ReadOnlySpan<byte> data)
Parameters
ticksintTime of this message in absolute MIDI ticks.
dataReadOnlySpan<byte>The data of the system exclusive message, excluding the starting 0xF0 byte.
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
TypeOf(int)
public static MidiMessage.Type TypeOf(int id)
Parameters
idint