radio42.Multimedia.MidiMidiOutputDevice
Namespace: radio42.Multimedia.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.2
The MidiOutputDevice type exposes the following members.
Name | Description | |
---|---|---|
![]() | MidiOutputDevice |
Creates a new instance of a MidiOutputDevice.
|
Name | Description | |
---|---|---|
![]() | Device |
Returns the device handle for this output device.
|
![]() | DeviceID |
Returns the device id (number) which was used to create this instance.
|
![]() | IsDisposed |
Returns , if this class is being disposed.
|
![]() | IsOpened |
Returns if the Midi output device is opened - else .
|
![]() | LastErrorCode |
Returns the last Midi error code (see MIDIError for possible values).
|
![]() | User |
User instance data to be used when sending system-exclusive messages.
|
Name | Description | |
---|---|---|
![]() ![]() | Close |
Closes the Midi output device using the DeviceID.
|
![]() | Connect |
Connects this output device (must actually be a MIDI thru device) to a MIDI output device.
|
![]() | Disconnect |
Disconnects this output device (must actually be a MIDI thru device) from a MIDI output device.
|
![]() | Dispose |
Releases all managed and unmanaged resources used by this class.
|
![]() | Finalize |
Destructor of the MidiOutputDevice for finalization code.
(Overrides ObjectFinalize.) |
![]() ![]() | GetDeviceCount |
Returns the total number of available Midi output devices.
|
![]() ![]() | GetDeviceDescription |
Returns the name of the given output device ID.
|
![]() ![]() | GetDeviceDescriptions |
Returns all available Midi output device names.
|
![]() ![]() | GetInfo |
Determines the capabilities of a specified MIDI output device.
|
![]() ![]() ![]() | GetMidiPorts |
Returns all available Midi output port IDs.
|
![]() ![]() | Open |
Opens the Midi output device using the DeviceID.
|
![]() ![]() | Send(Byte) |
Sends a system-exclusive message to the output Device.
|
![]() ![]() | Send(Int32) |
Sends a short message to the output Device.
|
![]() ![]() | Send(MidiShortMessage) |
Sends a short message to the output Device.
|
![]() ![]() | Send(MidiSysExMessage) |
Sends a system-exclusive message to the output Device.
|
![]() ![]() | Send(Byte, Byte, Byte) |
Sends a short message to the output Device.
|
![]() ![]() | Send(MIDIStatus, Byte, Byte, Byte) |
Sends a short message to the output Device.
|
Name | Description | |
---|---|---|
![]() | MessageReceived |
Event handler used to notify that the output device has processed a message or the status has changed.
|
After you have called the Open method the Device is being used.
It is a good idea to subscribe to the MessageReceived event handler before calling Open. However, this is generally not needed, since a for an output device there not many events being received (beside that the device is opened and closed and that the Midi output device has finished with a system-exclusive message). The MidiMessageEventArgs contains a MidiMessageEventType which allows you to react to all possible scenarios and to process all Midi messages and events.
To send any short or system-exclusive message use one of the Send(MidiShortMessage) overloads. You might use the MidiShortMessage resp. the MidiSysExMessage class in order to construct any message to be send.
Once you're done with the device call Close to close the device and release it.
using radio42.Multimedia.Midi; ... private MidiOutputDevice _outDevice; ... // open a certain Midi output device private void OpenDevice(int device) { _outDevice = new MidiOutputDevice(device); if (!_outDevice.Open()) MessageBox.Show(this, "Midi device could not be opened! Error " + _outDevice.LastErrorCode.ToString(), "Midi Error"); } } // close the Midi output device private void StopAndCloseDevice() { if (_outDevice != null && _outDevice.IsOpened) { _outDevice.Close(); } } ... // create and send a new short message to the output device MidiShortMessage msg = new MidiShortMessage(MIDIStatus.NoteOn, 0, 64, 65, 0); if ( _outDevice.Send(msg) ) Console.WriteLine("Error sending short message!"); ... // create a new system-exclusive message for the output device MidiSysExMessage sysex = new MidiSysExMessage(false, _outDevice.Device); sysex.CreateBuffer( new byte[7] {0xF0, 0x43, 0x75, 0x73, 0x12, 0x00, 0xF7} ); // send it if ( _outDevice.Send(sysex) ) Console.WriteLine("Error sending system-exclusive message!"); ...