Class MidiDevice
Represents a MIDI device.
Implements
Inherited Members
Namespace: Melanchall.DryWetMidi.Multimedia
Assembly: Melanchall.DryWetMidi.dll
Syntax
public abstract class MidiDevice : IDisposable
Fields
_disposed
Flag to detect redundant disposing.
Declaration
protected bool _disposed
Field Value
Type | Description |
---|---|
bool |
Properties
IsEnabled
Gets or sets a value indicating whether a device is enabled (i.e. operable) or not.
Declaration
public bool IsEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
Name
Gets the name of the current MIDI device.
Declaration
public abstract string Name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
Dispose()
Releases all resources used by the MIDI device class instance.
Declaration
public void Dispose()
EnsureDeviceIsNotDisposed()
Checks that current instance of MIDI device class is not disposed and throws
ObjectDisposedException if it is.
Declaration
protected void EnsureDeviceIsNotDisposed()
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | Current instance of MIDI device class is disposed. |
EnsureDeviceIsNotRemoved()
Checks that current instance of MIDI device class is not created via 'Device removed' notification
and throws InvalidOperationException if it is.
Declaration
protected void EnsureDeviceIsNotRemoved()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Current instance of MIDI device class is created via 'Device removed' notification. |
EnsureSessionIsCreated()
Ensures MIDI devices session is created.
Declaration
protected static void EnsureSessionIsCreated()
~MidiDevice()
Finalizes the current instance of the MIDI device class.
Declaration
protected ~MidiDevice()
OnError(Exception)
Raises ErrorOccurred event.
Declaration
protected void OnError(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | An exception that represents error occurred. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
Events
ErrorOccurred
Occurs when an error occurred on device (for example, during MIDI events parsing).
Declaration
public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
Event Type
Type | Description |
---|---|
EventHandler<ErrorOccurredEventArgs> |