BASS.NET API for the Un4seen BASS Audio Library

MidiShortMessageToString Method (String, IFormatProvider)

BASS.NET API for the Un4seen BASS Audio Library
Returns the string representation of the Midi short message.

Namespace:  radio42.Multimedia.Midi
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

public string ToString(
	string format,
	IFormatProvider formatProvider
)

Parameters

format
Type: SystemString
The format to use (one of the following):
"G"Combi-Format: Timestamp, Type, Channel, Status, Data in full text - same as "{T}\t{M} {C}\t{S}\t{D}" (for Channel messages) resp. "{T}\t{M}\t{S}\t{D}" (for other messages).
"g"Combi-Format: Timestamp, Type, Channel, Status, Data as numerical values - same as "{t}\t{m} {C}\t{s}\t{d}" (for Channel messages) resp. "{t}\t{m}\t{s}\t{d}" (for other messages).
"X"Combi-Format: Timespan and Message as hexadecimal values (big hex) - same as "{U} {A} {H}".
"x"Combi-Format: Timespan and Message as hexadecimal values (small hex) - same as "{u} {a} {h}".
"Y"Combi-Format: Message as hexadecimal values (big hex) - same as "{A} {H}".
"y"Combi-Format: Message as hexadecimal values (small hex) - same as "{a} {h}".
"T"Timespan only.
"t"Timestamp only.
"U"Timestamp only as hexadecimal values (big hex).
"u"Timestamp only as hexadecimal values (small hex).
"M"MessageType only in full text.
"m"MessageType as numerical values.
"S"StatusType only in full text.
"s"StatusType only as numerical value.
"A"Status only as hexadecimal values (big hex).
"a"Status only as hexadecimal values (small hex).
"C"Channel only as numerical value.
"D"Data only in full text.
"d"Data only as numerical value.
"H"Data only as hexadecimal values (big hex).
"h"Data only as hexadecimal values (small hex).

You might also combine the single values into a full format string when enclosed in brackets (e.g. "Time={T}: Msg={M}, Chan={C}, Status={S}, Data={D}"). In such case all the format values enclosed in brackets will be replaced by the above value representations. This allows you to format your individual message string.

formatProvider
Type: SystemIFormatProvider
The IFormatProvider which should be used or if the default schema values should be used.

Return Value

Type: String
The string representing the Midi short message.
Examples

public void MyMidiProc(IntPtr handle, MIDIMessage msg, IntPtr instance, IntPtr param1, IntPtr param2)
{
  if (msg == MIDIMessage.MIM_DATA)
  {
    // process the message...
    MidiShortMessage shortMsg = new MidiShortMessage(param1, param2);
    if (shortMsg.MessageType == MIDIMessageType.Channel)
      Console.WriteLine(shortMsg.ToString("Time={T}: Msg={M}, Chan={C}, Status={S}, {D}"));
    else if (shortMsg.MessageType == MIDIMessageType.SystemCommon)
      Console.WriteLine(shortMsg.ToString("Time={T}: Msg={M}, Status={S}, {D}"));
    else
      Console.WriteLine(shortMsg.ToString("G"));
    ...
  }
  ...
}
See Also

Reference