Struct MidiPatch

Namespace
SpessaSharp.MIDI
Assembly
SpessaSharp.dll
public readonly record struct MidiPatch : IEquatable<MidiPatch>
Implements
Inherited Members

Constructors

MidiPatch(int, int, int, bool)

public MidiPatch(int Program, int BankMSB, int BankLSB, bool IsGMGSDrum)

Parameters

Program int

The MIDI program number.

BankMSB int

The MIDI bank MSB number.

BankLSB int

The MIDI bank LSB number.

IsGMGSDrum bool

If the preset is marked as GM/GS drum preset. Note that XG drums do not have this flag.

Properties

BankLSB

The MIDI bank LSB number.

public int BankLSB { get; init; }

Property Value

int

BankMSB

The MIDI bank MSB number.

public int BankMSB { get; init; }

Property Value

int

IsGMGSDrum

If the preset is marked as GM/GS drum preset. Note that XG drums do not have this flag.

public bool IsGMGSDrum { get; init; }

Property Value

bool

Program

The MIDI program number.

public int Program { get; init; }

Property Value

int

Methods

Compare(MidiPatch, MidiPatch)

A comparison function for .sort() or .toSorted(), ordering the patches in ascending order.

public static int Compare(MidiPatch a, MidiPatch b)

Parameters

a MidiPatch
b MidiPatch

Returns

int

Order

From(ReadOnlySpan<char>)

Gets a MIDI patch from a string.

public static MidiPatch From(ReadOnlySpan<char> midiString)

Parameters

midiString ReadOnlySpan<char>

Returns

MidiPatch

The parsed patch

Matches(MidiPatch)

Checks if two MIDI patches represent the same one.

public bool Matches(MidiPatch p2)

Parameters

p2 MidiPatch

Returns

bool

ToMidiString()

Converts a given MIDIPatch to a string. The format is:

  • DRUM:program for GMGSDrum set to true.
  • bankLSB:bankMSB:program for GMGSDrum set to false.
public string ToMidiString()

Returns

string

Operators

implicit operator MidiPatch(Full)

public static implicit operator MidiPatch(MidiPatch.Full fullPatch)

Parameters

fullPatch MidiPatch.Full

Returns

MidiPatch