Canorus 0.0
Public Member Functions | Private Member Functions | List of all members
RtMidiOut Class Reference

A realtime MIDI output class. More...

#include <RtMidi.h>

Inheritance diagram for RtMidiOut:
Inheritance graph
[legend]

Public Member Functions

 RtMidiOut (const std::string clientName=std::string("RtMidi Output Client"))
 Default constructor that allows an optional client name. More...
 
 ~RtMidiOut ()
 The destructor closes any open MIDI connections. More...
 
void openPort (unsigned int portNumber=0, const std::string portName=std::string("RtMidi Output"))
 Open a MIDI output connection. More...
 
void closePort ()
 Close an open MIDI connection (if one exists). More...
 
void openVirtualPort (const std::string portName=std::string("RtMidi Output"))
 Create a virtual output port, with optional name, to allow software connections (OS X and ALSA only). More...
 
unsigned int getPortCount ()
 Return the number of available MIDI output ports. More...
 
std::string getPortName (unsigned int portNumber=0)
 Return a string identifier for the specified MIDI port type and number. More...
 
void sendMessage (std::vector< unsigned char > *message)
 Immediately send a single message out an open MIDI output port. More...
 
virtual void openPort (unsigned int portNumber=0, const std::string portName=std::string("RtMidi"))=0
 Pure virtual openPort() function. More...
 
virtual void openVirtualPort (const std::string portName=std::string("RtMidi"))=0
 Pure virtual openVirtualPort() function. More...
 
virtual unsigned int getPortCount ()=0
 Pure virtual getPortCount() function. More...
 
virtual std::string getPortName (unsigned int portNumber=0)=0
 Pure virtual getPortName() function. More...
 
virtual void closePort (void)=0
 Pure virtual closePort() function. More...
 

Private Member Functions

void initialize (const std::string &clientName)
 

Additional Inherited Members

- Protected Member Functions inherited from RtMidi
 RtMidi ()
 
virtual ~RtMidi ()
 
void error (RtError::Type type)
 
- Protected Attributes inherited from RtMidi
void * apiData_
 
bool connected_
 
std::string errorString_
 

Detailed Description

A realtime MIDI output class.

This class provides a common, platform-independent API for MIDI output. It allows one to probe available MIDI output ports, to connect to one such port, and to send MIDI bytes immediately over the connection. Create multiple instances of this class to connect to more than one MIDI device at the same time.

by Gary P. Scavone, 2003-2008.

Constructor & Destructor Documentation

◆ RtMidiOut()

RtMidiOut::RtMidiOut ( const std::string  clientName = std::string( "RtMidi Output Client" ))

Default constructor that allows an optional client name.

An exception will be thrown if a MIDI system initialization error occurs.

References initialize().

Here is the call graph for this function:

◆ ~RtMidiOut()

RtMidiOut::~RtMidiOut ( )

The destructor closes any open MIDI connections.

Member Function Documentation

◆ closePort()

void RtMidiOut::closePort ( )
virtual

Close an open MIDI connection (if one exists).

Implements RtMidi.

Referenced by CARtMidiDevice::closeOutputPort().

Here is the caller graph for this function:

◆ getPortCount()

unsigned int RtMidiOut::getPortCount ( )
virtual

Return the number of available MIDI output ports.

Implements RtMidi.

Referenced by CARtMidiDevice::getOutputPorts(), and CARtMidiDevice::openOutputPort().

Here is the caller graph for this function:

◆ getPortName()

std::string RtMidiOut::getPortName ( unsigned int  portNumber = 0)
virtual

Return a string identifier for the specified MIDI port type and number.

An exception is thrown if an invalid port specifier is provided.

Implements RtMidi.

Referenced by CARtMidiDevice::getOutputPorts().

Here is the caller graph for this function:

◆ initialize()

void RtMidiOut::initialize ( const std::string &  clientName)
private

Referenced by RtMidiOut().

Here is the caller graph for this function:

◆ openPort()

void RtMidiOut::openPort ( unsigned int  portNumber = 0,
const std::string  portName = std::string("RtMidi Output") 
)
virtual

Open a MIDI output connection.

An optional port number greater than 0 can be specified. Otherwise, the default or first port found is opened. An exception is thrown if an error occurs while attempting to make the port connection.

Implements RtMidi.

Referenced by CARtMidiDevice::openOutputPort().

Here is the caller graph for this function:

◆ openVirtualPort()

void RtMidiOut::openVirtualPort ( const std::string  portName = std::string("RtMidi Output"))
virtual

Create a virtual output port, with optional name, to allow software connections (OS X and ALSA only).

This function creates a virtual MIDI output port to which other software applications can connect. This type of functionality is currently only supported by the Macintosh OS-X and Linux ALSA APIs (the function does nothing with the other APIs). An exception is thrown if an error occurs while attempting to create the virtual port.

Implements RtMidi.

◆ sendMessage()

void RtMidiOut::sendMessage ( std::vector< unsigned char > *  message)

Immediately send a single message out an open MIDI output port.

An exception is thrown if an error occurs during output or an output connection was not previously established.

Referenced by CARtMidiDevice::send().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: