Update of RtAudio and RtMidi classes in advance of 4.6.0 release.

This commit is contained in:
Gary Scavone
2017-08-31 17:28:55 -07:00
parent d6c67cc479
commit 11d1dc54f3
4 changed files with 10699 additions and 10453 deletions

View File

@@ -45,11 +45,11 @@
#ifndef __RTAUDIO_H
#define __RTAUDIO_H
#define RTAUDIO_VERSION "4.1.2"
#define RTAUDIO_VERSION "5.0.0"
#include <string>
#include <vector>
#include <exception>
#include <stdexcept>
#include <iostream>
/*! \typedef typedef unsigned long RtAudioFormat;
@@ -86,6 +86,7 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi
- \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.
- \e RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use.
- \e RTAUDIO_ALSA_USE_DEFAULT: Use the "default" PCM device (ALSA only).
- \e RTAUDIO_JACK_DONT_CONNECT: Do not automatically connect ports (JACK only).
By default, RtAudio streams pass and receive audio data from the
client in an interleaved format. By passing the
@@ -117,6 +118,9 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi
If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to
open the "default" PCM device when using the ALSA API. Note that this
will override any specified input or output device id.
If the RTAUDIO_JACK_DONT_CONNECT flag is set, RtAudio will not attempt
to automatically connect the ports of the client to the audio device.
*/
typedef unsigned int RtAudioStreamFlags;
static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1; // Use non-interleaved buffers (default = interleaved).
@@ -124,6 +128,7 @@ static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2; // Attempt to s
static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4; // Attempt grab device and prevent use by others.
static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8; // Try to select realtime scheduling for callback thread.
static const RtAudioStreamFlags RTAUDIO_ALSA_USE_DEFAULT = 0x10; // Use the "default" PCM device (ALSA only).
static const RtAudioStreamFlags RTAUDIO_JACK_DONT_CONNECT = 0x20; // Do not automatically connect ports (JACK only).
/*! \typedef typedef unsigned long RtAudioStreamStatus;
\brief RtAudio stream status (over- or underflow) flags.
@@ -195,7 +200,7 @@ typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
*/
/************************************************************************/
class RtAudioError : public std::exception
class RtAudioError : public std::runtime_error
{
public:
//! Defined RtAudioError types.
@@ -214,25 +219,22 @@ class RtAudioError : public std::exception
};
//! The constructor.
RtAudioError( const std::string& message, Type type = RtAudioError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
//! The destructor.
virtual ~RtAudioError( void ) throw() {}
RtAudioError( const std::string& message,
Type type = RtAudioError::UNSPECIFIED )
: std::runtime_error(message), type_(type) {}
//! Prints thrown error message to stderr.
virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
virtual void printMessage( void ) const
{ std::cerr << '\n' << what() << "\n\n"; }
//! Returns the thrown error message type.
virtual const Type& getType(void) const throw() { return type_; }
virtual const Type& getType(void) const { return type_; }
//! Returns the thrown error message string.
virtual const std::string& getMessage(void) const throw() { return message_; }
//! Returns the thrown error message as a c-style string.
virtual const char* what( void ) const throw() { return message_.c_str(); }
virtual const std::string getMessage(void) const
{ return std::string(what()); }
protected:
std::string message_;
Type type_;
};
@@ -375,7 +377,7 @@ class RtAudio
};
//! A static function to determine the current RtAudio version.
static std::string getVersion( void ) throw();
static std::string getVersion( void );
//! A static function to determine the available compiled audio APIs.
/*!
@@ -383,7 +385,7 @@ class RtAudio
the enumerated list values. Note that there can be more than one
API compiled for certain operating systems.
*/
static void getCompiledApi( std::vector<RtAudio::Api> &apis ) throw();
static void getCompiledApi( std::vector<RtAudio::Api> &apis );
//! The class constructor.
/*!
@@ -401,10 +403,10 @@ class RtAudio
If a stream is running or open, it will be stopped and closed
automatically.
*/
~RtAudio() throw();
~RtAudio();
//! Returns the audio API specifier for the current instance of RtAudio.
RtAudio::Api getCurrentApi( void ) throw();
RtAudio::Api getCurrentApi( void );
//! A public function that queries for the number of audio devices available.
/*!
@@ -412,7 +414,7 @@ class RtAudio
is called, thus supporting devices connected \e after instantiation. If
a system error occurs during processing, a warning will be issued.
*/
unsigned int getDeviceCount( void ) throw();
unsigned int getDeviceCount( void );
//! Return an RtAudio::DeviceInfo structure for a specified device number.
/*!
@@ -435,7 +437,7 @@ class RtAudio
client's responsibility to verify that a device is available
before attempting to open a stream.
*/
unsigned int getDefaultOutputDevice( void ) throw();
unsigned int getDefaultOutputDevice( void );
//! A function that returns the index of the default input device.
/*!
@@ -445,7 +447,7 @@ class RtAudio
client's responsibility to verify that a device is available
before attempting to open a stream.
*/
unsigned int getDefaultInputDevice( void ) throw();
unsigned int getDefaultInputDevice( void );
//! A public function for opening a stream with the specified parameters.
/*!
@@ -498,7 +500,7 @@ class RtAudio
If a stream is not open, this function issues a warning and
returns (no exception is thrown).
*/
void closeStream( void ) throw();
void closeStream( void );
//! A function that starts a stream.
/*!
@@ -528,10 +530,10 @@ class RtAudio
void abortStream( void );
//! Returns true if a stream is open and false if not.
bool isStreamOpen( void ) const throw();
bool isStreamOpen( void ) const;
//! Returns true if the stream is running and false if it is stopped or not open.
bool isStreamRunning( void ) const throw();
bool isStreamRunning( void ) const;
//! Returns the number of elapsed seconds since the stream was started.
/*!
@@ -565,7 +567,7 @@ class RtAudio
unsigned int getStreamSampleRate( void );
//! Specify whether warning messages should be printed to stderr.
void showWarnings( bool value = true ) throw();
void showWarnings( bool value = true );
protected:
@@ -616,7 +618,7 @@ struct CallbackInfo {
// Default constructor.
CallbackInfo()
:object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false) {}
:object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false), priority(0) {}
};
// **************************************************************** //
@@ -824,22 +826,22 @@ protected:
//
// **************************************************************** //
inline RtAudio::Api RtAudio :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
inline unsigned int RtAudio :: getDeviceCount( void ) throw() { return rtapi_->getDeviceCount(); }
inline RtAudio::Api RtAudio :: getCurrentApi( void ) { return rtapi_->getCurrentApi(); }
inline unsigned int RtAudio :: getDeviceCount( void ) { return rtapi_->getDeviceCount(); }
inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); }
inline unsigned int RtAudio :: getDefaultInputDevice( void ) throw() { return rtapi_->getDefaultInputDevice(); }
inline unsigned int RtAudio :: getDefaultOutputDevice( void ) throw() { return rtapi_->getDefaultOutputDevice(); }
inline void RtAudio :: closeStream( void ) throw() { return rtapi_->closeStream(); }
inline unsigned int RtAudio :: getDefaultInputDevice( void ) { return rtapi_->getDefaultInputDevice(); }
inline unsigned int RtAudio :: getDefaultOutputDevice( void ) { return rtapi_->getDefaultOutputDevice(); }
inline void RtAudio :: closeStream( void ) { return rtapi_->closeStream(); }
inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); }
inline void RtAudio :: stopStream( void ) { return rtapi_->stopStream(); }
inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); }
inline bool RtAudio :: isStreamOpen( void ) const throw() { return rtapi_->isStreamOpen(); }
inline bool RtAudio :: isStreamRunning( void ) const throw() { return rtapi_->isStreamRunning(); }
inline bool RtAudio :: isStreamOpen( void ) const { return rtapi_->isStreamOpen(); }
inline bool RtAudio :: isStreamRunning( void ) const { return rtapi_->isStreamRunning(); }
inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); }
inline unsigned int RtAudio :: getStreamSampleRate( void ) { return rtapi_->getStreamSampleRate(); }
inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); }
inline void RtAudio :: setStreamTime( double time ) { return rtapi_->setStreamTime( time ); }
inline void RtAudio :: showWarnings( bool value ) throw() { rtapi_->showWarnings( value ); }
inline void RtAudio :: showWarnings( bool value ) { rtapi_->showWarnings( value ); }
// RtApi Subclass prototypes.
@@ -912,6 +914,8 @@ public:
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );
bool shouldAutoconnect_;
};
#endif

View File

@@ -43,7 +43,7 @@
#ifndef RTMIDI_H
#define RTMIDI_H
#define RTMIDI_VERSION "2.1.1"
#define RTMIDI_VERSION "3.0.0"
#include <exception>
#include <iostream>
@@ -139,10 +139,10 @@ class RtMidi
static void getCompiledApi( std::vector<RtMidi::Api> &apis ) throw();
//! Pure virtual openPort() function.
virtual void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi" ) ) = 0;
virtual void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi" ) ) = 0;
//! Pure virtual openVirtualPort() function.
virtual void openVirtualPort( const std::string portName = std::string( "RtMidi" ) ) = 0;
virtual void openVirtualPort( const std::string &portName = std::string( "RtMidi" ) ) = 0;
//! Pure virtual getPortCount() function.
virtual unsigned int getPortCount() = 0;
@@ -154,6 +154,10 @@ class RtMidi
virtual void closePort( void ) = 0;
//! Returns true if a port is open and false if not.
/*!
Note that this only applies to connections made with the openPort()
function, not to virtual ports.
*/
virtual bool isPortOpen( void ) const = 0;
//! Set an error callback function to be invoked when an error has occured.
@@ -185,7 +189,7 @@ class RtMidi
possible to open a virtual input port to which other MIDI software
clients can connect.
by Gary P. Scavone, 2003-2014.
by Gary P. Scavone, 2003-2017.
*/
/**********************************************************************/
@@ -229,7 +233,7 @@ class RtMidiIn : public RtMidi
\param queueSizeLimit An optional size of the MIDI input queue can be specified.
*/
RtMidiIn( RtMidi::Api api=UNSPECIFIED,
const std::string clientName = std::string( "RtMidi Input Client"),
const std::string& clientName = "RtMidi Input Client",
unsigned int queueSizeLimit = 100 );
//! If a MIDI connection is still open, it will be closed by the destructor.
@@ -244,7 +248,7 @@ class RtMidiIn : public RtMidi
Otherwise, the default or first port found is opened.
\param portName An optional name for the application port that is used to connect to portId can be specified.
*/
void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi Input" ) );
void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi Input" ) );
//! Create a virtual input port, with optional name, to allow software connections (OS X, JACK and ALSA only).
/*!
@@ -256,7 +260,7 @@ class RtMidiIn : public RtMidi
\param portName An optional name for the application port that is
used to connect to portId can be specified.
*/
void openVirtualPort( const std::string portName = std::string( "RtMidi Input" ) );
void openVirtualPort( const std::string &portName = std::string( "RtMidi Input" ) );
//! Set a callback function to be invoked for incoming MIDI messages.
/*!
@@ -282,6 +286,10 @@ class RtMidiIn : public RtMidi
void closePort( void );
//! Returns true if a port is open and false if not.
/*!
Note that this only applies to connections made with the openPort()
function, not to virtual ports.
*/
virtual bool isPortOpen() const;
//! Return the number of available MIDI input ports.
@@ -293,7 +301,8 @@ class RtMidiIn : public RtMidi
//! Return a string identifier for the specified MIDI input port number.
/*!
\return The name of the port with the given Id is returned.
\retval An empty string is returned if an invalid port specifier is provided.
\retval An empty string is returned if an invalid port specifier
is provided. User code should assume a UTF-8 encoding.
*/
std::string getPortName( unsigned int portNumber = 0 );
@@ -325,7 +334,7 @@ class RtMidiIn : public RtMidi
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );
protected:
void openMidiApi( RtMidi::Api api, const std::string clientName, unsigned int queueSizeLimit );
void openMidiApi( RtMidi::Api api, const std::string &clientName, unsigned int queueSizeLimit );
};
@@ -341,7 +350,7 @@ class RtMidiIn : public RtMidi
OS-X, Linux ALSA and JACK MIDI APIs, it is also possible to open a
virtual port to which other MIDI software clients can connect.
by Gary P. Scavone, 2003-2014.
by Gary P. Scavone, 2003-2017.
*/
/**********************************************************************/
@@ -358,7 +367,7 @@ class RtMidiOut : public RtMidi
JACK (OS-X).
*/
RtMidiOut( RtMidi::Api api=UNSPECIFIED,
const std::string clientName = std::string( "RtMidi Output Client") );
const std::string& clientName = "RtMidi Output Client" );
//! The destructor closes any open MIDI connections.
~RtMidiOut( void ) throw();
@@ -373,12 +382,16 @@ class RtMidiOut : public RtMidi
exception is thrown if an error occurs while attempting to make
the port connection.
*/
void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi Output" ) );
void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi Output" ) );
//! Close an open MIDI connection (if one exists).
void closePort( void );
//! Returns true if a port is open and false if not.
/*!
Note that this only applies to connections made with the openPort()
function, not to virtual ports.
*/
virtual bool isPortOpen() const;
//! Create a virtual output port, with optional name, to allow software connections (OS X, JACK and ALSA only).
@@ -390,14 +403,16 @@ class RtMidiOut : public RtMidi
An exception is thrown if an error occurs while attempting to
create the virtual port.
*/
void openVirtualPort( const std::string portName = std::string( "RtMidi Output" ) );
void openVirtualPort( const std::string &portName = std::string( "RtMidi Output" ) );
//! Return the number of available MIDI output ports.
unsigned int getPortCount( void );
//! Return a string identifier for the specified MIDI port type and number.
/*!
An empty string is returned if an invalid port specifier is provided.
\return The name of the port with the given Id is returned.
\retval An empty string is returned if an invalid port specifier
is provided. User code should assume a UTF-8 encoding.
*/
std::string getPortName( unsigned int portNumber = 0 );
@@ -406,7 +421,17 @@ class RtMidiOut : public RtMidi
An exception is thrown if an error occurs during output or an
output connection was not previously established.
*/
void sendMessage( std::vector<unsigned char> *message );
void sendMessage( const 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.
\param message A pointer to the MIDI message as raw bytes
\param size Length of the MIDI message in bytes
*/
void sendMessage( const unsigned char *message, size_t size );
//! Set an error callback function to be invoked when an error has occured.
/*!
@@ -416,7 +441,7 @@ class RtMidiOut : public RtMidi
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 );
protected:
void openMidiApi( RtMidi::Api api, const std::string clientName );
void openMidiApi( RtMidi::Api api, const std::string &clientName );
};
@@ -440,8 +465,8 @@ class MidiApi
MidiApi();
virtual ~MidiApi();
virtual RtMidi::Api getCurrentApi( void ) = 0;
virtual void openPort( unsigned int portNumber, const std::string portName ) = 0;
virtual void openVirtualPort( const std::string portName ) = 0;
virtual void openPort( unsigned int portNumber, const std::string &portName ) = 0;
virtual void openVirtualPort( const std::string &portName ) = 0;
virtual void closePort( void ) = 0;
virtual unsigned int getPortCount( void ) = 0;
@@ -479,6 +504,8 @@ class MidiInApi : public MidiApi
// messages. Each message represents one and only one MIDI message.
struct MidiMessage {
std::vector<unsigned char> bytes;
//! Time in seconds elapsed since the previous message
double timeStamp;
// Default constructor.
@@ -489,13 +516,16 @@ class MidiInApi : public MidiApi
struct MidiQueue {
unsigned int front;
unsigned int back;
unsigned int size;
unsigned int ringSize;
MidiMessage *ring;
// Default constructor.
MidiQueue()
:front(0), back(0), size(0), ringSize(0) {}
:front(0), back(0), ringSize(0), ring(0) {}
bool push(const MidiMessage&);
bool pop(std::vector<unsigned char>*, double*);
unsigned int size(unsigned int *back=0,
unsigned int *front=0);
};
// The RtMidiInData structure is used to pass private class data to
@@ -529,7 +559,7 @@ class MidiOutApi : public MidiApi
MidiOutApi( void );
virtual ~MidiOutApi( void );
virtual void sendMessage( std::vector<unsigned char> *message ) = 0;
virtual void sendMessage( const unsigned char *message, size_t size ) = 0;
};
// **************************************************************** //
@@ -539,8 +569,8 @@ class MidiOutApi : public MidiApi
// **************************************************************** //
inline RtMidi::Api RtMidiIn :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
inline void RtMidiIn :: openPort( unsigned int portNumber, const std::string portName ) { rtapi_->openPort( portNumber, portName ); }
inline void RtMidiIn :: openVirtualPort( const std::string portName ) { rtapi_->openVirtualPort( portName ); }
inline void RtMidiIn :: openPort( unsigned int portNumber, const std::string &portName ) { rtapi_->openPort( portNumber, portName ); }
inline void RtMidiIn :: openVirtualPort( const std::string &portName ) { rtapi_->openVirtualPort( portName ); }
inline void RtMidiIn :: closePort( void ) { rtapi_->closePort(); }
inline bool RtMidiIn :: isPortOpen() const { return rtapi_->isPortOpen(); }
inline void RtMidiIn :: setCallback( RtMidiCallback callback, void *userData ) { ((MidiInApi *)rtapi_)->setCallback( callback, userData ); }
@@ -552,13 +582,14 @@ inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { re
inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }
inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string portName ) { rtapi_->openPort( portNumber, portName ); }
inline void RtMidiOut :: openVirtualPort( const std::string portName ) { rtapi_->openVirtualPort( portName ); }
inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string &portName ) { rtapi_->openPort( portNumber, portName ); }
inline void RtMidiOut :: openVirtualPort( const std::string &portName ) { rtapi_->openVirtualPort( portName ); }
inline void RtMidiOut :: closePort( void ) { rtapi_->closePort(); }
inline bool RtMidiOut :: isPortOpen() const { return rtapi_->isPortOpen(); }
inline unsigned int RtMidiOut :: getPortCount( void ) { return rtapi_->getPortCount(); }
inline std::string RtMidiOut :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
inline void RtMidiOut :: sendMessage( std::vector<unsigned char> *message ) { ((MidiOutApi *)rtapi_)->sendMessage( message ); }
inline void RtMidiOut :: sendMessage( const std::vector<unsigned char> *message ) { ((MidiOutApi *)rtapi_)->sendMessage( &message->at(0), message->size() ); }
inline void RtMidiOut :: sendMessage( const unsigned char *message, size_t size ) { ((MidiOutApi *)rtapi_)->sendMessage( message, size ); }
inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }
// **************************************************************** //
@@ -576,11 +607,11 @@ inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback, vo
class MidiInCore: public MidiInApi
{
public:
MidiInCore( const std::string clientName, unsigned int queueSizeLimit );
MidiInCore( const std::string &clientName, unsigned int queueSizeLimit );
~MidiInCore( void );
RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; };
void openPort( unsigned int portNumber, const std::string portName );
void openVirtualPort( const std::string portName );
void openPort( unsigned int portNumber, const std::string &portName );
void openVirtualPort( const std::string &portName );
void closePort( void );
unsigned int getPortCount( void );
std::string getPortName( unsigned int portNumber );
@@ -592,15 +623,15 @@ class MidiInCore: public MidiInApi
class MidiOutCore: public MidiOutApi
{
public:
MidiOutCore( const std::string clientName );
MidiOutCore( const std::string &clientName );
~MidiOutCore( void );
RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; };
void openPort( unsigned int portNumber, const std::string portName );
void openVirtualPort( const std::string portName );
void openPort( unsigned int portNumber, const std::string &portName );
void openVirtualPort( const std::string &portName );
void closePort( void );
unsigned int getPortCount( void );
std::string getPortName( unsigned int portNumber );
void sendMessage( std::vector<unsigned char> *message );
void sendMessage( const unsigned char *message, size_t size );
protected:
void initialize( const std::string& clientName );
@@ -613,11 +644,11 @@ class MidiOutCore: public MidiOutApi
class MidiInJack: public MidiInApi
{
public:
MidiInJack( const std::string clientName, unsigned int queueSizeLimit );
MidiInJack( const std::string &clientName, unsigned int queueSizeLimit );
~MidiInJack( void );
RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; };
void openPort( unsigned int portNumber, const std::string portName );
void openVirtualPort( const std::string portName );
void openPort( unsigned int portNumber, const std::string &portName );
void openVirtualPort( const std::string &portName );
void closePort( void );
unsigned int getPortCount( void );
std::string getPortName( unsigned int portNumber );
@@ -632,15 +663,15 @@ class MidiInJack: public MidiInApi
class MidiOutJack: public MidiOutApi
{
public:
MidiOutJack( const std::string clientName );
MidiOutJack( const std::string &clientName );
~MidiOutJack( void );
RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; };
void openPort( unsigned int portNumber, const std::string portName );
void openVirtualPort( const std::string portName );
void openPort( unsigned int portNumber, const std::string &portName );
void openVirtualPort( const std::string &portName );
void closePort( void );
unsigned int getPortCount( void );
std::string getPortName( unsigned int portNumber );
void sendMessage( std::vector<unsigned char> *message );
void sendMessage( const unsigned char *message, size_t size );
protected:
std::string clientName;
@@ -656,11 +687,11 @@ class MidiOutJack: public MidiOutApi
class MidiInAlsa: public MidiInApi
{
public:
MidiInAlsa( const std::string clientName, unsigned int queueSizeLimit );
MidiInAlsa( const std::string &clientName, unsigned int queueSizeLimit );
~MidiInAlsa( void );
RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; };
void openPort( unsigned int portNumber, const std::string portName );
void openVirtualPort( const std::string portName );
void openPort( unsigned int portNumber, const std::string &portName );
void openVirtualPort( const std::string &portName );
void closePort( void );
unsigned int getPortCount( void );
std::string getPortName( unsigned int portNumber );
@@ -672,15 +703,15 @@ class MidiInAlsa: public MidiInApi
class MidiOutAlsa: public MidiOutApi
{
public:
MidiOutAlsa( const std::string clientName );
MidiOutAlsa( const std::string &clientName );
~MidiOutAlsa( void );
RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; };
void openPort( unsigned int portNumber, const std::string portName );
void openVirtualPort( const std::string portName );
void openPort( unsigned int portNumber, const std::string &portName );
void openVirtualPort( const std::string &portName );
void closePort( void );
unsigned int getPortCount( void );
std::string getPortName( unsigned int portNumber );
void sendMessage( std::vector<unsigned char> *message );
void sendMessage( const unsigned char *message, size_t size );
protected:
void initialize( const std::string& clientName );
@@ -693,11 +724,11 @@ class MidiOutAlsa: public MidiOutApi
class MidiInWinMM: public MidiInApi
{
public:
MidiInWinMM( const std::string clientName, unsigned int queueSizeLimit );
MidiInWinMM( const std::string &clientName, unsigned int queueSizeLimit );
~MidiInWinMM( void );
RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; };
void openPort( unsigned int portNumber, const std::string portName );
void openVirtualPort( const std::string portName );
void openPort( unsigned int portNumber, const std::string &portName );
void openVirtualPort( const std::string &portName );
void closePort( void );
unsigned int getPortCount( void );
std::string getPortName( unsigned int portNumber );
@@ -709,15 +740,15 @@ class MidiInWinMM: public MidiInApi
class MidiOutWinMM: public MidiOutApi
{
public:
MidiOutWinMM( const std::string clientName );
MidiOutWinMM( const std::string &clientName );
~MidiOutWinMM( void );
RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; };
void openPort( unsigned int portNumber, const std::string portName );
void openVirtualPort( const std::string portName );
void openPort( unsigned int portNumber, const std::string &portName );
void openVirtualPort( const std::string &portName );
void closePort( void );
unsigned int getPortCount( void );
std::string getPortName( unsigned int portNumber );
void sendMessage( std::vector<unsigned char> *message );
void sendMessage( const unsigned char *message, size_t size );
protected:
void initialize( const std::string& clientName );
@@ -730,13 +761,13 @@ class MidiOutWinMM: public MidiOutApi
class MidiInDummy: public MidiInApi
{
public:
MidiInDummy( const std::string /*clientName*/, unsigned int queueSizeLimit ) : MidiInApi( queueSizeLimit ) { errorString_ = "MidiInDummy: This class provides no functionality."; error( RtMidiError::WARNING, errorString_ ); }
MidiInDummy( const std::string &/*clientName*/, unsigned int queueSizeLimit ) : MidiInApi( queueSizeLimit ) { errorString_ = "MidiInDummy: This class provides no functionality."; error( RtMidiError::WARNING, errorString_ ); }
RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; }
void openPort( unsigned int /*portNumber*/, const std::string /*portName*/ ) {}
void openVirtualPort( const std::string /*portName*/ ) {}
void openPort( unsigned int /*portNumber*/, const std::string &/*portName*/ ) {}
void openVirtualPort( const std::string &/*portName*/ ) {}
void closePort( void ) {}
unsigned int getPortCount( void ) { return 0; }
std::string getPortName( unsigned int portNumber ) { return ""; }
std::string getPortName( unsigned int /*portNumber*/ ) { return ""; }
protected:
void initialize( const std::string& /*clientName*/ ) {}
@@ -745,14 +776,14 @@ class MidiInDummy: public MidiInApi
class MidiOutDummy: public MidiOutApi
{
public:
MidiOutDummy( const std::string /*clientName*/ ) { errorString_ = "MidiOutDummy: This class provides no functionality."; error( RtMidiError::WARNING, errorString_ ); }
MidiOutDummy( const std::string &/*clientName*/ ) { errorString_ = "MidiOutDummy: This class provides no functionality."; error( RtMidiError::WARNING, errorString_ ); }
RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; }
void openPort( unsigned int /*portNumber*/, const std::string /*portName*/ ) {}
void openVirtualPort( const std::string /*portName*/ ) {}
void openPort( unsigned int /*portNumber*/, const std::string &/*portName*/ ) {}
void openVirtualPort( const std::string &/*portName*/ ) {}
void closePort( void ) {}
unsigned int getPortCount( void ) { return 0; }
std::string getPortName( unsigned int /*portNumber*/ ) { return ""; }
void sendMessage( std::vector<unsigned char> * /*message*/ ) {}
void sendMessage( const unsigned char * /*message*/, size_t /*size*/ ) {}
protected:
void initialize( const std::string& /*clientName*/ ) {}