Opens the Midi output device using the DeviceID.
Namespace: radio42.Multimedia.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
Return Value
Type: Booleanon success, else .
Remarks
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.
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