![]() |
wxMidi - A MIDI interface based on PortMidi
|
Abstract class representing a MIDI device. More...
#include <wxMidi.h>
Public Member Functions | |
wxMidiDevice (wxMidiDeviceID nDevice) | |
Constructor. More... | |
virtual | ~wxMidiDevice () |
Destructor. | |
wxMidiError | Close () |
Closes a MIDI stream, flushing any pending messages. More... | |
const wxString | DeviceName () |
Returns a string containing the name of the MIDI device. More... | |
const wxString | InterfaceUsed () |
Returns a string containing the name of the API used internally by portmidi to implement MIDI communication. More... | |
bool | IsInputPort () |
Returns true if the device has input capabilities and then can be used as wxMidiInDevice. More... | |
bool | IsOutputPort () |
Returns true if the device has output capabilities and then can be used as wxMidiOutDevice. More... | |
int | HasHostError () |
Check if the wxMidiDevice has a pending host error to be reported. More... | |
Protected Attributes | |
wxMidiDeviceID | m_nDevice |
const PmDeviceInfo * | m_pInfo |
PortMidiStream * | m_stream |
Abstract class representing a MIDI device.
The base interface for devices is wxMidiDevice. It is an abstract class with two derived classes: wxMidiInDevice and wxMidiOutDevice.
A wxMidiDevice object represents a MIDI stream on which MIDI data traffic can be read or sent. All MIDI communication is achieved through a wxMidiDevice by using MIDI messages. Devices can be opened and closed, and they provide descriptions of themselves.
MIDI messages are represented by the wxMidiMessage abstract class and are read and sent from/to the MIDI stream by using methods Read() and Write(), respectively.
For the most common output operations, such as note on or note off, there are specific methods implemented so that wxMidi user has not to build and send the appropriate messages. See:
wxMidiDevice::wxMidiDevice | ( | wxMidiDeviceID | nDevice | ) |
Constructor.
nDevice | The number of the device. Device numbers (also referred as device IDs) range from 0 to wxMidiSystem::CountDevices() - 1 |
|
inline |
Closes a MIDI stream, flushing any pending messages.
Any wxMidiDevice that is successfully opened should eventually be closed calling Close().
const wxString wxMidiDevice::DeviceName | ( | ) |
Returns a string containing the name of the MIDI device.
For example "MPU-401 Compatible card".
|
inline |
Check if the wxMidiDevice has a pending host error to be reported.
Normally, the application finds out about wxMidi errors through returned error codes, but some errors can occur asynchronously where the application does not explicitly call a function, and therefore cannot receive an error code.
The client can test for a pending error using method HasHostError(). If true, the error can be accessed and cleared by calling wxMidiSystem::GetErrorText(). It is nor necessary to call HasHostError() as any pending error will be reported the next time the application performs an explicit function call on the wxMidiDevice, i.e. an input or output operation.
const wxString wxMidiDevice::InterfaceUsed | ( | ) |
Returns a string containing the name of the API used internally by portmidi to implement MIDI communication.
Examples are "MMSystem", "DirectX", "ALSA", "OSS", etc.
bool wxMidiDevice::IsInputPort | ( | ) |
Returns true if the device has input capabilities and then can be used as wxMidiInDevice.
bool wxMidiDevice::IsOutputPort | ( | ) |
Returns true if the device has output capabilities and then can be used as wxMidiOutDevice.