BASS.NET API for the Un4seen BASS Audio LibraryMidiInputDeviceStop Method BASS.NET API for the Un4seen BASS Audio Library
Stops recording messages from the Midi input device using the DeviceID.

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

public bool Stop()

Return Value

Type: Boolean
on success, else .

The Device must have been opened and started to record messages. You might use the IsOpened and IsStarted properties to check this. Call Open to open the Midi input device and Start to start recording messages. After you have called this method the Device is no longer recording and receiving any ShortMessage or SysExMessage.

When you have subscribed to the MessageReceived event you'll get notified when a new message was received from the Midi input device. To start recording messages again call the Start method.

Once you're done with the device call Close to close the device and release it.


Opens the Midi input device #0:
Private _inDevice As MidiInputDevice
_inDevice = New MidiInputDevice(0)
AddHandler _inDevice.MessageReceived, AddressOf InDevice_MessageReceived
If _inDevice.Open() Then
  If Not _inDevice.Start() Then
    MessageBox.Show(Me, "Midi device could not be started! Error " + _inDevice.LastErrorCode.ToString(), "Midi Error")
  End If
  MessageBox.Show(Me, "Midi device could not be opened! Error " + _inDevice.LastErrorCode.ToString(), "Midi Error")
End If 
' when done
If _inDevice.IsStarted Then
End If
If _inDevice.IsOpened Then
End If
Private Sub InDevice_MessageReceived(sender As Object, e As MidiMessageEventArgs)
  If e.IsShortMessage Then
    Console.WriteLine("{0} : {1}", e.ShortMessage.ID, e.ShortMessage.ToString())
    If e.IsSysExMessage Then
      Console.WriteLine("{0} : {1}", e.SysExMessage.ID, e.SysExMessage.ToString())
    End If
  End If
End Sub
private MidiInputDevice _inDevice;
_inDevice = new MidiInputDevice(0);
_inDevice.MessageReceived += new MidiMessageEventHandler(InDevice_MessageReceived);
if (_inDevice.Open())
  if (!_inDevice.Start())
    MessageBox.Show(this, "Midi device could not be started! Error " + _inDevice.LastErrorCode.ToString(), "Midi Error");
  MessageBox.Show(this, "Midi device could not be opened! Error " + _inDevice.LastErrorCode.ToString(), "Midi Error");
// when done
if (_inDevice.IsStarted)
if (_inDevice.IsOpened)
private void InDevice_MessageReceived(object sender, MidiMessageEventArgs e)
  if (e.IsShortMessage)
    Console.WriteLine("{0} : {1}", e.ShortMessage.ID, e.ShortMessage.ToString());
  else if (e.IsSysExMessage)
    Console.WriteLine("{0} : {1}", e.SysExMessage.ID, e.SysExMessage.ToString());
See Also