BASS.NET API for the Un4seen BASS Audio LibraryMidiShortMessageToString Method (String)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.12.0
Syntax

public string ToString(
	string format
)

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.

Return Value

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

VB
Public Sub MyMidiProc(handle As IntPtr, msg As MIDIMessage, instance As IntPtr, param1 As IntPtr, param2 As IntPtr)
  If msg = MIDIMessage.MIM_DATA Then
    ' process the message...
    Dim shortMsg As New MidiShortMessage(param1, param2)
    If shortMsg.MessageType = MIDIMessageType.Channel Then
      Console.WriteLine(shortMsg.ToString("Time={T}: Msg={M}, Chan={C}, Status={S}, {D}"))
    Else
      If shortMsg.MessageType = MIDIMessageType.SystemCommon Then
        Console.WriteLine(shortMsg.ToString("Time={T}: Msg={M}, Status={S}, {D}"))
      Else
        Console.WriteLine(shortMsg.ToString("G"))
      End If
    End If
    ...
  End If 
  ...
End Sub
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