mirror of
https://github.com/thestk/stk
synced 2026-01-11 12:01:52 +00:00
Updated RtAudio/RtMidi for new release, plus additional documentation updates.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
and OSS), Macintosh OS X (CoreAudio and Jack), and Windows
|
||||
(DirectSound, ASIO and WASAPI) operating systems.
|
||||
|
||||
RtAudio GitHub site: https://github.com/thestk/rtaudio
|
||||
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
|
||||
|
||||
RtAudio: realtime audio i/o C++ classes
|
||||
@@ -45,7 +46,21 @@
|
||||
#ifndef __RTAUDIO_H
|
||||
#define __RTAUDIO_H
|
||||
|
||||
#define RTAUDIO_VERSION "5.0.0"
|
||||
#define RTAUDIO_VERSION "5.1.0"
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined(RTAUDIO_EXPORT)
|
||||
#define RTAUDIO_DLL_PUBLIC __declspec(dllexport)
|
||||
#else
|
||||
#define RTAUDIO_DLL_PUBLIC
|
||||
#endif
|
||||
#else
|
||||
#if __GNUC__ >= 4
|
||||
#define RTAUDIO_DLL_PUBLIC __attribute__( (visibility( "default" )) )
|
||||
#else
|
||||
#define RTAUDIO_DLL_PUBLIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -179,6 +194,7 @@ static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2; // The output
|
||||
\param userData A pointer to optional data provided by the client
|
||||
when opening the stream (default = NULL).
|
||||
|
||||
\return
|
||||
To continue normal stream operation, the RtAudioCallback function
|
||||
should return a value of zero. To stop the stream and drain the
|
||||
output buffer, the function should return a value of one. To abort
|
||||
@@ -200,7 +216,7 @@ typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
|
||||
*/
|
||||
/************************************************************************/
|
||||
|
||||
class RtAudioError : public std::runtime_error
|
||||
class RTAUDIO_DLL_PUBLIC RtAudioError : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
//! Defined RtAudioError types.
|
||||
@@ -260,7 +276,7 @@ typedef void (*RtAudioErrorCallback)( RtAudioError::Type type, const std::string
|
||||
|
||||
class RtApi;
|
||||
|
||||
class RtAudio
|
||||
class RTAUDIO_DLL_PUBLIC RtAudio
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -271,11 +287,12 @@ class RtAudio
|
||||
LINUX_PULSE, /*!< The Linux PulseAudio API. */
|
||||
LINUX_OSS, /*!< The Linux Open Sound System API. */
|
||||
UNIX_JACK, /*!< The Jack Low-Latency Audio Server API. */
|
||||
MACOSX_CORE, /*!< Macintosh OS-X CoreAudio API. */
|
||||
MACOSX_CORE, /*!< Macintosh OS-X Core Audio API. */
|
||||
WINDOWS_WASAPI, /*!< The Microsoft WASAPI API. */
|
||||
WINDOWS_ASIO, /*!< The Steinberg Audio Stream I/O API. */
|
||||
WINDOWS_DS, /*!< The Microsoft DirectSound API. */
|
||||
RTAUDIO_DUMMY /*!< A compilable but non-functional API. */
|
||||
RTAUDIO_DUMMY, /*!< A compilable but non-functional API. */
|
||||
NUM_APIS /*!< Number of values in this enum. */
|
||||
};
|
||||
|
||||
//! The public device information structure for returning queried values.
|
||||
@@ -387,6 +404,29 @@ class RtAudio
|
||||
*/
|
||||
static void getCompiledApi( std::vector<RtAudio::Api> &apis );
|
||||
|
||||
//! Return the name of a specified compiled audio API.
|
||||
/*!
|
||||
This obtains a short lower-case name used for identification purposes.
|
||||
This value is guaranteed to remain identical across library versions.
|
||||
If the API is unknown, this function will return the empty string.
|
||||
*/
|
||||
static std::string getApiName( RtAudio::Api api );
|
||||
|
||||
//! Return the display name of a specified compiled audio API.
|
||||
/*!
|
||||
This obtains a long name used for display purposes.
|
||||
If the API is unknown, this function will return the empty string.
|
||||
*/
|
||||
static std::string getApiDisplayName( RtAudio::Api api );
|
||||
|
||||
//! Return the compiled audio API having the given name.
|
||||
/*!
|
||||
A case insensitive comparison will check the specified name
|
||||
against the list of compiled APIs, and return the one which
|
||||
matches. On failure, the function returns UNSPECIFIED.
|
||||
*/
|
||||
static RtAudio::Api getCompiledApiByName( const std::string &name );
|
||||
|
||||
//! The class constructor.
|
||||
/*!
|
||||
The constructor performs minor initialization tasks. An exception
|
||||
@@ -583,6 +623,7 @@ class RtAudio
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uintptr_t ThreadHandle;
|
||||
typedef CRITICAL_SECTION StreamMutex;
|
||||
@@ -651,7 +692,6 @@ class S24 {
|
||||
return *this;
|
||||
}
|
||||
|
||||
S24( const S24& v ) { *this = v; }
|
||||
S24( const double& d ) { *this = (int) d; }
|
||||
S24( const float& f ) { *this = (int) f; }
|
||||
S24( const signed short& s ) { *this = (int) s; }
|
||||
@@ -671,7 +711,7 @@ class S24 {
|
||||
|
||||
#include <sstream>
|
||||
|
||||
class RtApi
|
||||
class RTAUDIO_DLL_PUBLIC RtApi
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -864,7 +904,6 @@ public:
|
||||
void startStream( void );
|
||||
void stopStream( void );
|
||||
void abortStream( void );
|
||||
long getStreamLatency( void );
|
||||
|
||||
// This function is intended for internal use only. It must be
|
||||
// public because it is called by the internal callback handler,
|
||||
@@ -900,7 +939,6 @@ public:
|
||||
void startStream( void );
|
||||
void stopStream( void );
|
||||
void abortStream( void );
|
||||
long getStreamLatency( void );
|
||||
|
||||
// This function is intended for internal use only. It must be
|
||||
// public because it is called by the internal callback handler,
|
||||
@@ -935,7 +973,6 @@ public:
|
||||
void startStream( void );
|
||||
void stopStream( void );
|
||||
void abortStream( void );
|
||||
long getStreamLatency( void );
|
||||
|
||||
// This function is intended for internal use only. It must be
|
||||
// public because it is called by the internal callback handler,
|
||||
@@ -973,7 +1010,6 @@ public:
|
||||
void startStream( void );
|
||||
void stopStream( void );
|
||||
void abortStream( void );
|
||||
long getStreamLatency( void );
|
||||
|
||||
// This function is intended for internal use only. It must be
|
||||
// public because it is called by the internal callback handler,
|
||||
@@ -1003,7 +1039,7 @@ class RtApiWasapi : public RtApi
|
||||
{
|
||||
public:
|
||||
RtApiWasapi();
|
||||
~RtApiWasapi();
|
||||
virtual ~RtApiWasapi();
|
||||
|
||||
RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_WASAPI; }
|
||||
unsigned int getDeviceCount( void );
|
||||
|
||||
321
include/RtMidi.h
321
include/RtMidi.h
@@ -5,7 +5,8 @@
|
||||
This class implements some common functionality for the realtime
|
||||
MIDI input/output subclasses RtMidiIn and RtMidiOut.
|
||||
|
||||
RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/
|
||||
RtMidi GitHub site: https://github.com/thestk/rtmidi
|
||||
RtMidi WWW site: http://www.music.mcgill.ca/~gary/rtmidi/
|
||||
|
||||
RtMidi: realtime MIDI i/o C++ classes
|
||||
Copyright (c) 2003-2019 Gary P. Scavone
|
||||
@@ -43,7 +44,21 @@
|
||||
#ifndef RTMIDI_H
|
||||
#define RTMIDI_H
|
||||
|
||||
#define RTMIDI_VERSION "3.0.0"
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined(RTMIDI_EXPORT)
|
||||
#define RTMIDI_DLL_PUBLIC __declspec(dllexport)
|
||||
#else
|
||||
#define RTMIDI_DLL_PUBLIC
|
||||
#endif
|
||||
#else
|
||||
#if __GNUC__ >= 4
|
||||
#define RTMIDI_DLL_PUBLIC __attribute__( (visibility( "default" )) )
|
||||
#else
|
||||
#define RTMIDI_DLL_PUBLIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define RTMIDI_VERSION "4.0.0"
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
@@ -60,7 +75,7 @@
|
||||
*/
|
||||
/************************************************************************/
|
||||
|
||||
class RtMidiError : public std::exception
|
||||
class RTMIDI_DLL_PUBLIC RtMidiError : public std::exception
|
||||
{
|
||||
public:
|
||||
//! Defined RtMidiError types.
|
||||
@@ -79,8 +94,9 @@ class RtMidiError : public std::exception
|
||||
};
|
||||
|
||||
//! The constructor.
|
||||
RtMidiError( const std::string& message, Type type = RtMidiError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
|
||||
|
||||
RtMidiError( const std::string& message, Type type = RtMidiError::UNSPECIFIED ) throw()
|
||||
: message_(message), type_(type) {}
|
||||
|
||||
//! The destructor.
|
||||
virtual ~RtMidiError( void ) throw() {}
|
||||
|
||||
@@ -88,10 +104,10 @@ class RtMidiError : public std::exception
|
||||
virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
|
||||
|
||||
//! Returns the thrown error message type.
|
||||
virtual const Type& getType(void) const throw() { return type_; }
|
||||
virtual const Type& getType( void ) const throw() { return type_; }
|
||||
|
||||
//! Returns the thrown error message string.
|
||||
virtual const std::string& getMessage(void) const throw() { return message_; }
|
||||
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(); }
|
||||
@@ -113,10 +129,9 @@ typedef void (*RtMidiErrorCallback)( RtMidiError::Type type, const std::string &
|
||||
|
||||
class MidiApi;
|
||||
|
||||
class RtMidi
|
||||
class RTMIDI_DLL_PUBLIC RtMidi
|
||||
{
|
||||
public:
|
||||
|
||||
//! MIDI API specifier arguments.
|
||||
enum Api {
|
||||
UNSPECIFIED, /*!< Search for a working compiled API. */
|
||||
@@ -124,7 +139,8 @@ class RtMidi
|
||||
LINUX_ALSA, /*!< The Advanced Linux Sound Architecture API. */
|
||||
UNIX_JACK, /*!< The JACK Low-Latency MIDI Server API. */
|
||||
WINDOWS_MM, /*!< The Microsoft Multimedia MIDI API. */
|
||||
RTMIDI_DUMMY /*!< A compilable but non-functional API. */
|
||||
RTMIDI_DUMMY, /*!< A compilable but non-functional API. */
|
||||
NUM_APIS /*!< Number of values in this enum. */
|
||||
};
|
||||
|
||||
//! A static function to determine the current RtMidi version.
|
||||
@@ -138,6 +154,29 @@ class RtMidi
|
||||
*/
|
||||
static void getCompiledApi( std::vector<RtMidi::Api> &apis ) throw();
|
||||
|
||||
//! Return the name of a specified compiled MIDI API.
|
||||
/*!
|
||||
This obtains a short lower-case name used for identification purposes.
|
||||
This value is guaranteed to remain identical across library versions.
|
||||
If the API is unknown, this function will return the empty string.
|
||||
*/
|
||||
static std::string getApiName( RtMidi::Api api );
|
||||
|
||||
//! Return the display name of a specified compiled MIDI API.
|
||||
/*!
|
||||
This obtains a long name used for display purposes.
|
||||
If the API is unknown, this function will return the empty string.
|
||||
*/
|
||||
static std::string getApiDisplayName( RtMidi::Api api );
|
||||
|
||||
//! Return the compiled MIDI API having the given name.
|
||||
/*!
|
||||
A case insensitive comparison will check the specified name
|
||||
against the list of compiled APIs, and return the one which
|
||||
matches. On failure, the function returns UNSPECIFIED.
|
||||
*/
|
||||
static RtMidi::Api getCompiledApiByName( const std::string &name );
|
||||
|
||||
//! Pure virtual openPort() function.
|
||||
virtual void openPort( unsigned int portNumber = 0, const std::string &portName = std::string( "RtMidi" ) ) = 0;
|
||||
|
||||
@@ -153,6 +192,9 @@ class RtMidi
|
||||
//! Pure virtual closePort() function.
|
||||
virtual void closePort( void ) = 0;
|
||||
|
||||
void setClientName( const std::string &clientName );
|
||||
void setPortName( const std::string &portName );
|
||||
|
||||
//! Returns true if a port is open and false if not.
|
||||
/*!
|
||||
Note that this only applies to connections made with the openPort()
|
||||
@@ -168,10 +210,8 @@ class RtMidi
|
||||
virtual void setErrorCallback( RtMidiErrorCallback errorCallback = NULL, void *userData = 0 ) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
RtMidi();
|
||||
virtual ~RtMidi();
|
||||
|
||||
MidiApi *rtapi_;
|
||||
};
|
||||
|
||||
@@ -188,8 +228,6 @@ class RtMidi
|
||||
time. With the OS-X, Linux ALSA, and JACK MIDI APIs, it is also
|
||||
possible to open a virtual input port to which other MIDI software
|
||||
clients can connect.
|
||||
|
||||
by Gary P. Scavone, 2003-2019.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
@@ -207,12 +245,12 @@ class RtMidi
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
class RtMidiIn : public RtMidi
|
||||
class RTMIDI_DLL_PUBLIC RtMidiIn : public RtMidi
|
||||
{
|
||||
public:
|
||||
|
||||
//! User callback function type definition.
|
||||
typedef void (*RtMidiCallback)( double timeStamp, std::vector<unsigned char> *message, void *userData);
|
||||
typedef void (*RtMidiCallback)( double timeStamp, std::vector<unsigned char> *message, void *userData );
|
||||
|
||||
//! Default constructor that allows an optional api, client name and queue size.
|
||||
/*!
|
||||
@@ -335,7 +373,6 @@ class RtMidiIn : public RtMidi
|
||||
|
||||
protected:
|
||||
void openMidiApi( RtMidi::Api api, const std::string &clientName, unsigned int queueSizeLimit );
|
||||
|
||||
};
|
||||
|
||||
/**********************************************************************/
|
||||
@@ -349,15 +386,12 @@ class RtMidiIn : public RtMidi
|
||||
connect to more than one MIDI device at the same time. With the
|
||||
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-2019.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
class RtMidiOut : public RtMidi
|
||||
class RTMIDI_DLL_PUBLIC RtMidiOut : public RtMidi
|
||||
{
|
||||
public:
|
||||
|
||||
//! Default constructor that allows an optional client name.
|
||||
/*!
|
||||
An exception will be thrown if a MIDI system initialization error occurs.
|
||||
@@ -458,7 +492,7 @@ class RtMidiOut : public RtMidi
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
class MidiApi
|
||||
class RTMIDI_DLL_PUBLIC MidiApi
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -468,6 +502,8 @@ class MidiApi
|
||||
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 void setClientName( const std::string &clientName ) = 0;
|
||||
virtual void setPortName( const std::string &portName ) = 0;
|
||||
|
||||
virtual unsigned int getPortCount( void ) = 0;
|
||||
virtual std::string getPortName( unsigned int portNumber ) = 0;
|
||||
@@ -489,7 +525,7 @@ protected:
|
||||
void *errorCallbackUserData_;
|
||||
};
|
||||
|
||||
class MidiInApi : public MidiApi
|
||||
class RTMIDI_DLL_PUBLIC MidiInApi : public MidiApi
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -502,15 +538,15 @@ class MidiInApi : public MidiApi
|
||||
|
||||
// A MIDI structure used internally by the class to store incoming
|
||||
// messages. Each message represents one and only one MIDI message.
|
||||
struct MidiMessage {
|
||||
std::vector<unsigned char> bytes;
|
||||
struct MidiMessage {
|
||||
std::vector<unsigned char> bytes;
|
||||
|
||||
//! Time in seconds elapsed since the previous message
|
||||
double timeStamp;
|
||||
|
||||
// Default constructor.
|
||||
MidiMessage()
|
||||
:bytes(0), timeStamp(0.0) {}
|
||||
MidiMessage()
|
||||
: bytes(0), timeStamp(0.0) {}
|
||||
};
|
||||
|
||||
struct MidiQueue {
|
||||
@@ -520,12 +556,11 @@ class MidiInApi : public MidiApi
|
||||
MidiMessage *ring;
|
||||
|
||||
// Default constructor.
|
||||
MidiQueue()
|
||||
: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);
|
||||
MidiQueue()
|
||||
: 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
|
||||
@@ -543,17 +578,16 @@ class MidiInApi : public MidiApi
|
||||
bool continueSysex;
|
||||
|
||||
// Default constructor.
|
||||
RtMidiInData()
|
||||
: ignoreFlags(7), doInput(false), firstMessage(true),
|
||||
apiData(0), usingCallback(false), userCallback(0), userData(0),
|
||||
continueSysex(false) {}
|
||||
RtMidiInData()
|
||||
: ignoreFlags(7), doInput(false), firstMessage(true), apiData(0), usingCallback(false),
|
||||
userCallback(0), userData(0), continueSysex(false) {}
|
||||
};
|
||||
|
||||
protected:
|
||||
RtMidiInData inputData_;
|
||||
};
|
||||
|
||||
class MidiOutApi : public MidiApi
|
||||
class RTMIDI_DLL_PUBLIC MidiOutApi : public MidiApi
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -573,12 +607,12 @@ inline void RtMidiIn :: openPort( unsigned int portNumber, const std::string &po
|
||||
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 ); }
|
||||
inline void RtMidiIn :: cancelCallback( void ) { ((MidiInApi *)rtapi_)->cancelCallback(); }
|
||||
inline void RtMidiIn :: setCallback( RtMidiCallback callback, void *userData ) { static_cast<MidiInApi *>(rtapi_)->setCallback( callback, userData ); }
|
||||
inline void RtMidiIn :: cancelCallback( void ) { static_cast<MidiInApi *>(rtapi_)->cancelCallback(); }
|
||||
inline unsigned int RtMidiIn :: getPortCount( void ) { return rtapi_->getPortCount(); }
|
||||
inline std::string RtMidiIn :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
|
||||
inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { ((MidiInApi *)rtapi_)->ignoreTypes( midiSysex, midiTime, midiSense ); }
|
||||
inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { return ((MidiInApi *)rtapi_)->getMessage( message ); }
|
||||
inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { static_cast<MidiInApi *>(rtapi_)->ignoreTypes( midiSysex, midiTime, midiSense ); }
|
||||
inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { return static_cast<MidiInApi *>(rtapi_)->getMessage( message ); }
|
||||
inline void RtMidiIn :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }
|
||||
|
||||
inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
|
||||
@@ -588,207 +622,8 @@ 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( 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 :: sendMessage( const std::vector<unsigned char> *message ) { static_cast<MidiOutApi *>(rtapi_)->sendMessage( &message->at(0), message->size() ); }
|
||||
inline void RtMidiOut :: sendMessage( const unsigned char *message, size_t size ) { static_cast<MidiOutApi *>(rtapi_)->sendMessage( message, size ); }
|
||||
inline void RtMidiOut :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userData ) { rtapi_->setErrorCallback(errorCallback, userData); }
|
||||
|
||||
// **************************************************************** //
|
||||
//
|
||||
// MidiInApi and MidiOutApi subclass prototypes.
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
#if !defined(__LINUX_ALSA__) && !defined(__UNIX_JACK__) && !defined(__MACOSX_CORE__) && !defined(__WINDOWS_MM__)
|
||||
#define __RTMIDI_DUMMY__
|
||||
#endif
|
||||
|
||||
#if defined(__MACOSX_CORE__)
|
||||
|
||||
class MidiInCore: public MidiInApi
|
||||
{
|
||||
public:
|
||||
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 closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
class MidiOutCore: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
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 closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
void sendMessage( const unsigned char *message, size_t size );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__UNIX_JACK__)
|
||||
|
||||
class MidiInJack: public MidiInApi
|
||||
{
|
||||
public:
|
||||
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 closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
|
||||
protected:
|
||||
std::string clientName;
|
||||
|
||||
void connect( void );
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
class MidiOutJack: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
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 closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
void sendMessage( const unsigned char *message, size_t size );
|
||||
|
||||
protected:
|
||||
std::string clientName;
|
||||
|
||||
void connect( void );
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__LINUX_ALSA__)
|
||||
|
||||
class MidiInAlsa: public MidiInApi
|
||||
{
|
||||
public:
|
||||
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 closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
class MidiOutAlsa: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
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 closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
void sendMessage( const unsigned char *message, size_t size );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__WINDOWS_MM__)
|
||||
|
||||
class MidiInWinMM: public MidiInApi
|
||||
{
|
||||
public:
|
||||
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 closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
class MidiOutWinMM: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
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 closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
void sendMessage( const unsigned char *message, size_t size );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__RTMIDI_DUMMY__)
|
||||
|
||||
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_ ); }
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; }
|
||||
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 ""; }
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& /*clientName*/ ) {}
|
||||
};
|
||||
|
||||
class MidiOutDummy: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
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 closePort( void ) {}
|
||||
unsigned int getPortCount( void ) { return 0; }
|
||||
std::string getPortName( unsigned int /*portNumber*/ ) { return ""; }
|
||||
void sendMessage( const unsigned char * /*message*/, size_t /*size*/ ) {}
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& /*clientName*/ ) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user