C# Класс Midi.OutputDevice

A MIDI output device.

Each instance of this class describes a MIDI output device installed on the system. You cannot create your own instances, but instead must go through the InstalledDevices property to find which devices are available. You may wish to examine the DeviceBase.Name property of each one and present the user with a choice of which device to use.

Open an output device with Open and close it with Close. While it is open, you may send MIDI messages with functions such as SendNoteOn, SendNoteOff and SendProgramChange. All notes may be silenced on the device by calling SilenceAllNotes.

Note that the above methods send their messages immediately. If you wish to arrange for a message to be sent at a specific future time, you'll need to instantiate some subclass of Message (eg NoteOnMessage) and then pass it to Clock.Schedule.

Наследование: Midi.DeviceBase
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Close ( ) : void

Closes this output device.

Open ( ) : void

Opens this output device.

SendControlChange ( Channel channel, Control control, int value ) : void

Sends a Control Change message to this MIDI output device.

SendNoteOff ( Channel channel, Pitch pitch, int velocity ) : void

Sends a Note Off message to this MIDI output device.

SendNoteOn ( Channel channel, Pitch pitch, int velocity ) : void

Sends a Note On message to this MIDI output device.

SendPercussion ( Percussion percussion, int velocity ) : void

Sends a Note On message to Channel10 of this MIDI output device.

This is simply shorthand for a Note On message on Channel10 with a percussion-specific note, so there is no corresponding message to receive from an input device.

SendPitchBend ( Channel channel, int value ) : void

Sends a Pitch Bend message to this MIDI output device.

SendProgramChange ( Channel channel, Instrument instrument ) : void

Sends a Program Change message to this MIDI output device.

A Program Change message is used to switch among instrument settings, generally instrument voices. An instrument conforming to General Midi 1 will have the instruments described in the Instrument enum; other instruments may have different instrument sets.

SendSysEx ( Byte data ) : void

Sends a System Exclusive (sysex) message to this MIDI output device.

SilenceAllNotes ( ) : void

Silences all notes on this output device.

UpdateInstalledDevices ( ) : void

Refresh the list of input devices

Приватные методы

Метод Описание
CheckNotOpen ( ) : void

Throws a MidiDeviceException if this device is open.

CheckOpen ( ) : void

Throws a MidiDeviceException if this device is not open.

CheckReturnCode ( Win32API rc ) : void

Makes sure rc is MidiWin32Wrapper.MMSYSERR_NOERROR. If not, throws an exception with an appropriate error message.

MakeDeviceList ( ) : Midi.OutputDevice[]

Private method for constructing the array of MidiOutputDevices by calling the Win32 api.

OutputDevice ( UIntPtr deviceId, Win32API caps ) : System

Private Constructor, only called by the getter for the InstalledDevices property.

Описание методов

Close() публичный Метод

Closes this output device.
The device is not open. The device cannot be closed.
public Close ( ) : void
Результат void

Open() публичный Метод

Opens this output device.
The device is already open. The device cannot be opened.
public Open ( ) : void
Результат void

SendControlChange() публичный Метод

Sends a Control Change message to this MIDI output device.
channel, control, or value is /// out-of-range. The device is not open. The message cannot be sent.
public SendControlChange ( Channel channel, Control control, int value ) : void
channel Channel The channel.
control Control The control.
value int The new value 0..127.
Результат void

SendNoteOff() публичный Метод

Sends a Note Off message to this MIDI output device.
channel, note, or velocity is /// out-of-range. The device is not open. The message cannot be sent.
public SendNoteOff ( Channel channel, Pitch pitch, int velocity ) : void
channel Channel The channel.
pitch Pitch The pitch.
velocity int The velocity 0..127.
Результат void

SendNoteOn() публичный Метод

Sends a Note On message to this MIDI output device.
channel, pitch, or velocity is /// out-of-range. The device is not open. The message cannot be sent.
public SendNoteOn ( Channel channel, Pitch pitch, int velocity ) : void
channel Channel The channel.
pitch Pitch The pitch.
velocity int The velocity 0..127.
Результат void

SendPercussion() публичный Метод

Sends a Note On message to Channel10 of this MIDI output device.
This is simply shorthand for a Note On message on Channel10 with a percussion-specific note, so there is no corresponding message to receive from an input device.
percussion or velocity is out-of-range. /// The device is not open. The message cannot be sent.
public SendPercussion ( Percussion percussion, int velocity ) : void
percussion Percussion The percussion.
velocity int The velocity 0..127.
Результат void

SendPitchBend() публичный Метод

Sends a Pitch Bend message to this MIDI output device.
channel or value is out-of-range. /// The device is not open. The message cannot be sent.
public SendPitchBend ( Channel channel, int value ) : void
channel Channel The channel.
value int The pitch bend value, 0..16383, 8192 is centered.
Результат void

SendProgramChange() публичный Метод

Sends a Program Change message to this MIDI output device.
A Program Change message is used to switch among instrument settings, generally instrument voices. An instrument conforming to General Midi 1 will have the instruments described in the Instrument enum; other instruments may have different instrument sets.
channel or instrument is out-of-range. /// The device is not open. The message cannot be sent.
public SendProgramChange ( Channel channel, Instrument instrument ) : void
channel Channel The channel.
instrument Instrument The instrument.
Результат void

SendSysEx() публичный Метод

Sends a System Exclusive (sysex) message to this MIDI output device.
The message cannot be sent.
public SendSysEx ( Byte data ) : void
data Byte The message to send (as byte array)
Результат void

SilenceAllNotes() публичный Метод

Silences all notes on this output device.
The device is not open. The message cannot be sent.
public SilenceAllNotes ( ) : void
Результат void

UpdateInstalledDevices() публичный статический Метод

Refresh the list of input devices
public static UpdateInstalledDevices ( ) : void
Результат void