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

Ticks int

Absolute number of MIDI ticks from the start of the track.

StatusByte StatusByte

The MIDI message status byte. Note that for meta events, it is the second byte. (not 0xFF).

Data ArraySegment<byte>

Message's binary data.

Properties

Data

Message's binary data.

public ArraySegment<byte> Data { get; init; }

Property Value

ArraySegment<byte>

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

StatusByte

Ticks

Absolute number of MIDI ticks from the start of the track.

public int Ticks { get; init; }

Property Value

int

Methods

ChannelPressure(int, int, int)

Returns a new MIDI Channel Pressure message.

public static MidiMessage ChannelPressure(int ticks, int channel, int value)

Parameters

ticks int

Time of this message in absolute MIDI ticks.

channel int

The channel number of this message.

value int

The new value, between 0 and 127.

Returns

MidiMessage

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

ticks int

Time of this message in absolute MIDI ticks.

channel int

The channel number of this message.

controller Midi.CC

The MIDI controller.

value int

The new value.

Returns

MidiMessage

GetTempo()

public double GetTempo()

Returns

double

ID(Type)

public static int ID(MidiMessage.Type type)

Parameters

type MidiMessage.Type

Returns

int

PitchWheel(int, int, int)

Returns a new MIDI Pitch Wheel message.

public static MidiMessage PitchWheel(int ticks, int channel, int value)

Parameters

ticks int

Time of this message in absolute MIDI ticks.

channel int

The channel number of this message.

value int

The new value, between 0 and 16_383, where 8_192 is the center (no pitch change).

Returns

MidiMessage

ProgramChange(int, int, int)

Returns a new MIDI Program Change message.

public static MidiMessage ProgramChange(int ticks, int channel, int program)

Parameters

ticks int

Time of this message in absolute MIDI ticks.

channel int

The channel number of this message.

program int

The new MIDI program number, between 0 and 127.

Returns

MidiMessage

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

ticks int

Time of this message in absolute MIDI ticks.

channel int

The channel number of this message.

parameter int

The 14-bit MIDI registered parameter number.

value int

The 14-bit new value.

Returns

MidiMessage[]

SystemExclusive(int, ReadOnlySpan<byte>)

Returns a new MIDI System Exclusive message.

public static MidiMessage SystemExclusive(int ticks, ReadOnlySpan<byte> data)

Parameters

ticks int

Time of this message in absolute MIDI ticks.

data ReadOnlySpan<byte>

The data of the system exclusive message, excluding the starting 0xF0 byte.

Returns

MidiMessage

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

id int

Returns

MidiMessage.Type