BASS.NET API for the Un4seen BASS Audio LibraryMidiOutputDeviceOpen Method BASS.NET API for the Un4seen BASS Audio Library
Opens the Midi output device using the DeviceID.

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

public bool Open()

Return Value

Type: Boolean
on success, else .

After you have called this method the Device is being used and you might send messages to the device using the Send(MidiShortMessage) methods.

When you have subscribed to the MessageReceived event you'll get notified when the device is opened (Opened) and closed (Closed).

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


Private _outDevice As MidiOutputDevice
_outDevice = New MidiOutputDevice(0)
AddHandler _outDevice.MessageReceived, AddressOf OutDevice_MessageReceived
If Not _outDevice.Open() Then
  MessageBox.Show(Me, "Midi device could not be opened! Error " + _outDevice.LastErrorCode.ToString(), "Midi Error")
End If
' when done
If _outDevice.IsOpened Then
End If
Private Sub OutDevice_MessageReceived(sender As Object, e As MidiMessageEventArgs)
  If e.EventType = MidiMessageEventType.Opened Then
   Console.WriteLine("Midi device {0} opened.", e.DeviceID)
    If e.EventType = MidiMessageEventType.Closed Then
      Console.WriteLine("Midi device {0} closed.", e.DeviceID)
    End If
  End If
End Sub
private MidiOutputDevice _outDevice;
_outDevice = new MidiOutputDevice(0);
_outDevice.MessageReceived += new MidiMessageEventHandler(OutDevice_MessageReceived);
if (!_outDevice.Open())
  MessageBox.Show(this, "Midi device could not be opened! Error " + _outDevice.LastErrorCode.ToString(), "Midi Error");
// when done
if (_outDevice.IsOpened)
private void OutDevice_MessageReceived(object sender, MidiMessageEventArgs e)
  if (e.EventType == MidiMessageEventType.Opened)
    Console.WriteLine("Midi device {0} opened.", e.DeviceID);
  else if (e.EventType == MidiMessageEventType.Closed)
    Console.WriteLine("Midi device {0} closed.", e.DeviceID);
See Also