NiCMidi 1.1.0
A MIDI library derived from J.D.Koftinoff jdksmidi
|
Sends MIDI messages to an hardware MIDI out port. More...
#include <driver.h>
Public Member Functions | |
MIDIOutDriver (int id) | |
Creates a MIDIOutDriver object which can send MIDI messages to the given hardware out port. More... | |
virtual | ~MIDIOutDriver () |
The destructor closes the hardware port and deletes the object. More... | |
virtual void | Reset () |
Resets the driver to default conditions: More... | |
int | GetPortId () const |
Returns the id number of the hardware out port. More... | |
std::string | GetPortName () |
Returns the name of the hardware out port. More... | |
bool | IsPortOpen () const |
Returns true is the hardware port is open. More... | |
MIDIProcessor * | GetOutProcessor () |
Returns a pointer to the out processor. More... | |
const MIDIProcessor * | GetOutProcessor () const |
Returns a pointer to the out processor. More... | |
virtual void | SetOutProcessor (MIDIProcessor *proc) |
Sets the out processor, which can manipulate all outgoing messages (see MIDIProcessor). More... | |
virtual void | OpenPort () |
Opens the hardware out port. More... | |
virtual void | ClosePort () |
Closes the hardware out port. More... | |
virtual void | AllNotesOff (int chan=-1) |
Turns off all the sounding notes on the port (or on the given MIDI channel). More... | |
virtual void | OutputMessage (const MIDITimedMessage &msg) |
Makes a copy of the message, processes it with the out processor and then sends it to the hardware port. More... | |
Protected Member Functions | |
virtual void | HardwareMsgOut (const MIDIMessage &msg) |
Sends the message to the hardware MIDI port using the RtMidi library functions. More... | |
Static Protected Attributes | |
static const int | DRIVER_MAX_RETRIES = 100 |
The maximum number of retries the method OutputMessage() will try before hanging (and skipping a message). More... | |
static const int | DRIVER_WAIT_AFTER_SYSEX = 20 |
The number of milliseconds the driver waits after sending a MIDI system exclusive message. More... | |
Sends MIDI messages to an hardware MIDI out port.
Every MIDI out port is denoted by a specific id number, enumerated by the RtMidi class, and by a name, given by the OS; this class communicates between the hardware ports and the other library classes. You can set a MIDIProcessor for processing outgoing MIDI messages.
When the program starts, the MIDIManager searches for all the hardware ports in the system and creates a driver for everyone of them, so you find them ready to use.
MIDIOutDriver::MIDIOutDriver | ( | int | id | ) |
Creates a MIDIOutDriver object which can send MIDI messages to the given hardware out port.
id | The id of the hardware port. Numbers of the ports and their names can be retrieved by the MIDIManager::GetNumMIDIOuts() and MIDIManager::GetMIDIOutName() static methods. |
|
virtual |
The destructor closes the hardware port and deletes the object.
|
virtual |
Resets the driver to default conditions:
|
inline |
Returns the id number of the hardware out port.
|
inline |
Returns the name of the hardware out port.
|
inline |
Returns true is the hardware port is open.
|
inline |
Returns a pointer to the out processor.
|
inline |
Returns a pointer to the out processor.
|
inlinevirtual |
Sets the out processor, which can manipulate all outgoing messages (see MIDIProcessor).
If you want to eliminate a processor already set, call it with 0 as parameter (this only sets the processor pointer to 0! The driver doesn't own its processor).
|
virtual |
Opens the hardware out port.
This usually requires a noticeable amount of time, so it's better not to immediately start to send messages. If the port is already open the object remembers how many times it was open, so a corresponding number of ClosePort() must be called to effectively close the port.
|
virtual |
Closes the hardware out port.
If the port was open more than once it only decrements the count (leaving it open), while it does nothing if the port is already close. If you want to force the closure call Reset().
|
virtual |
Turns off all the sounding notes on the port (or on the given MIDI channel).
This is normally done by sending an All Notes Off message, but you can change this behaviour (see DRIVER_USES_MIDIMATRIX). See also Numbering conventions.
chan | if you left the default silences all channels, otherwise you can give an unique channel to turn off |
|
virtual |
Makes a copy of the message, processes it with the out processor and then sends it to the hardware port.
If the port is busy waits 1 msec and retries until DRIVER_MAX_RETRIES is reached.
|
protectedvirtual |
Sends the message to the hardware MIDI port using the RtMidi library functions.
|
staticprotected |
The maximum number of retries the method OutputMessage() will try before hanging (and skipping a message).
|
staticprotected |
The number of milliseconds the driver waits after sending a MIDI system exclusive message.