BASS.NET API for the Un4seen BASS Audio Library

MidiOutputDeviceClose Method

BASS.NET API for the Un4seen BASS Audio Library
Closes the Midi output device using the DeviceID.

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

public bool Close()

Return Value

Type: Boolean
on success, else .
Remarks

After you have called this method the Device is no longer valid and released.

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

After you have closed the Midi output device you might open it again using the Open method.

Examples

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)
  _outDevice.Close();
...
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

Reference