1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189 |
- #ifndef __RTAUDIO_H
- #define __RTAUDIO_H
- #define RTAUDIO_VERSION "5.2.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>
- #include <stdexcept>
- #include <iostream>
- typedef unsigned long RtAudioFormat;
- static const RtAudioFormat RTAUDIO_SINT8 = 0x1;
- static const RtAudioFormat RTAUDIO_SINT16 = 0x2;
- static const RtAudioFormat RTAUDIO_SINT24 = 0x4;
- static const RtAudioFormat RTAUDIO_SINT32 = 0x8;
- static const RtAudioFormat RTAUDIO_FLOAT32 = 0x10;
- static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20;
- typedef unsigned int RtAudioStreamFlags;
- static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1;
- static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2;
- static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4;
- static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8;
- static const RtAudioStreamFlags RTAUDIO_ALSA_USE_DEFAULT = 0x10;
- static const RtAudioStreamFlags RTAUDIO_JACK_DONT_CONNECT = 0x20;
- typedef unsigned int RtAudioStreamStatus;
- static const RtAudioStreamStatus RTAUDIO_INPUT_OVERFLOW = 0x1;
- static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2;
- typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
- unsigned int nFrames,
- double streamTime,
- RtAudioStreamStatus status,
- void *userData );
- class RTAUDIO_DLL_PUBLIC RtAudioError : public std::runtime_error
- {
- public:
-
- enum Type {
- WARNING,
- DEBUG_WARNING,
- UNSPECIFIED,
- NO_DEVICES_FOUND,
- INVALID_DEVICE,
- MEMORY_ERROR,
- INVALID_PARAMETER,
- INVALID_USE,
- DRIVER_ERROR,
- SYSTEM_ERROR,
- THREAD_ERROR
- };
-
- RtAudioError( const std::string& message,
- Type type = RtAudioError::UNSPECIFIED )
- : std::runtime_error(message), type_(type) {}
-
- virtual void printMessage( void ) const
- { std::cerr << '\n' << what() << "\n\n"; }
-
- virtual const Type& getType(void) const { return type_; }
-
- virtual const std::string getMessage(void) const
- { return std::string(what()); }
- protected:
- Type type_;
- };
- typedef void (*RtAudioErrorCallback)( RtAudioError::Type type, const std::string &errorText );
- class RtApi;
- class RTAUDIO_DLL_PUBLIC RtAudio
- {
- public:
-
- enum Api {
- UNSPECIFIED,
- LINUX_ALSA,
- LINUX_PULSE,
- LINUX_OSS,
- UNIX_JACK,
- MACOSX_CORE,
- WINDOWS_WASAPI,
- WINDOWS_ASIO,
- WINDOWS_DS,
- RTAUDIO_DUMMY,
- NUM_APIS
- };
-
- struct DeviceInfo {
- bool probed;
- std::string name;
- unsigned int outputChannels{};
- unsigned int inputChannels{};
- unsigned int duplexChannels{};
- bool isDefaultOutput{false};
- bool isDefaultInput{false};
- std::vector<unsigned int> sampleRates;
- unsigned int preferredSampleRate{};
- RtAudioFormat nativeFormats{};
- };
-
- struct StreamParameters {
- unsigned int deviceId{};
- unsigned int nChannels{};
- unsigned int firstChannel{};
- };
-
-
- struct StreamOptions {
- RtAudioStreamFlags flags{};
- unsigned int numberOfBuffers{};
- std::string streamName;
- int priority{};
- };
-
- static std::string getVersion( void );
-
-
- static void getCompiledApi( std::vector<RtAudio::Api> &apis );
-
-
- static std::string getApiName( RtAudio::Api api );
-
-
- static std::string getApiDisplayName( RtAudio::Api api );
-
-
- static RtAudio::Api getCompiledApiByName( const std::string &name );
-
-
- RtAudio( RtAudio::Api api=UNSPECIFIED );
-
-
- ~RtAudio();
-
- RtAudio::Api getCurrentApi( void );
-
-
- unsigned int getDeviceCount( void );
-
-
- RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
-
-
- unsigned int getDefaultOutputDevice( void );
-
-
- unsigned int getDefaultInputDevice( void );
-
-
- void openStream( RtAudio::StreamParameters *outputParameters,
- RtAudio::StreamParameters *inputParameters,
- RtAudioFormat format, unsigned int sampleRate,
- unsigned int *bufferFrames, RtAudioCallback callback,
- void *userData = NULL, RtAudio::StreamOptions *options = NULL, RtAudioErrorCallback errorCallback = NULL );
-
-
- void closeStream( void );
-
-
- void startStream( void );
-
-
- void stopStream( void );
-
-
- void abortStream( void );
-
- bool isStreamOpen( void ) const;
-
- bool isStreamRunning( void ) const;
-
-
- double getStreamTime( void );
-
-
- void setStreamTime( double time );
-
-
- long getStreamLatency( void );
-
-
- unsigned int getStreamSampleRate( void );
-
- void showWarnings( bool value = true );
- protected:
- void openRtApi( RtAudio::Api api );
- RtApi *rtapi_;
- };
- #if defined(_WIN32) || defined(__CYGWIN__)
- #ifndef NOMINMAX
- #define NOMINMAX
- #endif
- #include <windows.h>
- #include <process.h>
- #include <stdint.h>
- typedef uintptr_t ThreadHandle;
- typedef CRITICAL_SECTION StreamMutex;
- #else
-
- #include <pthread.h>
- typedef pthread_t ThreadHandle;
- typedef pthread_mutex_t StreamMutex;
- #endif
- #if !(defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_WASAPI__) \
- || defined(__LINUX_ALSA__) || defined(__LINUX_PULSE__) || defined(__UNIX_JACK__) \
- || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__))
- #define __RTAUDIO_DUMMY__
- #endif
- struct CallbackInfo {
- void *object{};
- ThreadHandle thread{};
- void *callback{};
- void *userData{};
- void *errorCallback{};
- void *apiInfo{};
- bool isRunning{false};
- bool doRealtime{false};
- int priority{};
- };
- #pragma pack(push, 1)
- class S24 {
- protected:
- unsigned char c3[3];
- public:
- S24() {}
- S24& operator = ( const int& i ) {
- c3[0] = (unsigned char)(i & 0x000000ff);
- c3[1] = (unsigned char)((i & 0x0000ff00) >> 8);
- c3[2] = (unsigned char)((i & 0x00ff0000) >> 16);
- return *this;
- }
- S24( const double& d ) { *this = (int) d; }
- S24( const float& f ) { *this = (int) f; }
- S24( const signed short& s ) { *this = (int) s; }
- S24( const char& c ) { *this = (int) c; }
- int asInt() {
- int i = c3[0] | (c3[1] << 8) | (c3[2] << 16);
- if (i & 0x800000) i |= ~0xffffff;
- return i;
- }
- };
- #pragma pack(pop)
- #if defined( HAVE_GETTIMEOFDAY )
- #include <sys/time.h>
- #endif
- #include <sstream>
- class RTAUDIO_DLL_PUBLIC RtApi
- {
- public:
- RtApi();
- virtual ~RtApi();
- virtual RtAudio::Api getCurrentApi( void ) = 0;
- virtual unsigned int getDeviceCount( void ) = 0;
- virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0;
- virtual unsigned int getDefaultInputDevice( void );
- virtual unsigned int getDefaultOutputDevice( void );
- void openStream( RtAudio::StreamParameters *outputParameters,
- RtAudio::StreamParameters *inputParameters,
- RtAudioFormat format, unsigned int sampleRate,
- unsigned int *bufferFrames, RtAudioCallback callback,
- void *userData, RtAudio::StreamOptions *options,
- RtAudioErrorCallback errorCallback );
- virtual void closeStream( void );
- virtual void startStream( void ) = 0;
- virtual void stopStream( void ) = 0;
- virtual void abortStream( void ) = 0;
- long getStreamLatency( void );
- unsigned int getStreamSampleRate( void );
- virtual double getStreamTime( void );
- virtual void setStreamTime( double time );
- bool isStreamOpen( void ) const { return stream_.state != STREAM_CLOSED; }
- bool isStreamRunning( void ) const { return stream_.state == STREAM_RUNNING; }
- void showWarnings( bool value ) { showWarnings_ = value; }
- protected:
- static const unsigned int MAX_SAMPLE_RATES;
- static const unsigned int SAMPLE_RATES[];
- enum { FAILURE, SUCCESS };
- enum StreamState {
- STREAM_STOPPED,
- STREAM_STOPPING,
- STREAM_RUNNING,
- STREAM_CLOSED = -50
- };
- enum StreamMode {
- OUTPUT,
- INPUT,
- DUPLEX,
- UNINITIALIZED = -75
- };
-
- struct ConvertInfo {
- int channels;
- int inJump, outJump;
- RtAudioFormat inFormat, outFormat;
- std::vector<int> inOffset;
- std::vector<int> outOffset;
- };
-
- struct RtApiStream {
- unsigned int device[2];
- void *apiHandle;
- StreamMode mode;
- StreamState state;
- char *userBuffer[2];
- char *deviceBuffer;
- bool doConvertBuffer[2];
- bool userInterleaved;
- bool deviceInterleaved[2];
- bool doByteSwap[2];
- unsigned int sampleRate;
- unsigned int bufferSize;
- unsigned int nBuffers;
- unsigned int nUserChannels[2];
- unsigned int nDeviceChannels[2];
- unsigned int channelOffset[2];
- unsigned long latency[2];
- RtAudioFormat userFormat;
- RtAudioFormat deviceFormat[2];
- StreamMutex mutex;
- CallbackInfo callbackInfo;
- ConvertInfo convertInfo[2];
- double streamTime;
- #if defined(HAVE_GETTIMEOFDAY)
- struct timeval lastTickTimestamp;
- #endif
- RtApiStream()
- :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; }
- };
- typedef S24 Int24;
- typedef signed short Int16;
- typedef signed int Int32;
- typedef float Float32;
- typedef double Float64;
- std::ostringstream errorStream_;
- std::string errorText_;
- bool showWarnings_;
- RtApiStream stream_;
- bool firstErrorOccurred_;
-
- virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
- unsigned int firstChannel, unsigned int sampleRate,
- RtAudioFormat format, unsigned int *bufferSize,
- RtAudio::StreamOptions *options );
-
- void tickStreamTime( void );
-
- void clearStreamInfo();
-
- void verifyStream( void );
-
- void error( RtAudioError::Type type );
-
- void convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info );
-
- void byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format );
-
- unsigned int formatBytes( RtAudioFormat format );
-
- void setConvertInfo( StreamMode mode, unsigned int firstChannel );
- };
- 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 ) { 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 { 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 ) { rtapi_->showWarnings( value ); }
- #if defined(__MACOSX_CORE__)
- #include <CoreAudio/AudioHardware.h>
- class RtApiCore: public RtApi
- {
- public:
- RtApiCore();
- ~RtApiCore();
- RtAudio::Api getCurrentApi( void ) override { return RtAudio::MACOSX_CORE; }
- unsigned int getDeviceCount( void ) override;
- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
- unsigned int getDefaultOutputDevice( void ) override;
- unsigned int getDefaultInputDevice( void ) override;
- void closeStream( void ) override;
- void startStream( void ) override;
- void stopStream( void ) override;
- void abortStream( void ) override;
-
-
-
-
- bool callbackEvent( AudioDeviceID deviceId,
- const AudioBufferList *inBufferList,
- const AudioBufferList *outBufferList );
- private:
- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
- unsigned int firstChannel, unsigned int sampleRate,
- RtAudioFormat format, unsigned int *bufferSize,
- RtAudio::StreamOptions *options ) override;
- static const char* getErrorCode( OSStatus code );
- };
- #endif
- #if defined(__UNIX_JACK__)
- class RtApiJack: public RtApi
- {
- public:
- RtApiJack();
- ~RtApiJack();
- RtAudio::Api getCurrentApi( void ) override { return RtAudio::UNIX_JACK; }
- unsigned int getDeviceCount( void ) override;
- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
- void closeStream( void ) override;
- void startStream( void ) override;
- void stopStream( void ) override;
- void abortStream( void ) override;
-
-
-
-
- bool callbackEvent( unsigned long nframes );
- private:
- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
- unsigned int firstChannel, unsigned int sampleRate,
- RtAudioFormat format, unsigned int *bufferSize,
- RtAudio::StreamOptions *options ) override;
- bool shouldAutoconnect_;
- };
- #endif
- #if defined(__WINDOWS_ASIO__)
- class RtApiAsio: public RtApi
- {
- public:
- RtApiAsio();
- ~RtApiAsio();
- RtAudio::Api getCurrentApi( void ) override { return RtAudio::WINDOWS_ASIO; }
- unsigned int getDeviceCount( void ) override;
- unsigned int getDefaultOutputDevice( void ) override;
- unsigned int getDefaultInputDevice( void ) override;
- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
- void closeStream( void ) override;
- void startStream( void ) override;
- void stopStream( void ) override;
- void abortStream( void ) override;
-
-
-
-
- bool callbackEvent( long bufferIndex );
- private:
- std::vector<RtAudio::DeviceInfo> devices_;
- void saveDeviceInfo( void );
- bool coInitialized_;
- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
- unsigned int firstChannel, unsigned int sampleRate,
- RtAudioFormat format, unsigned int *bufferSize,
- RtAudio::StreamOptions *options ) override;
- };
- #endif
- #if defined(__WINDOWS_DS__)
- class RtApiDs: public RtApi
- {
- public:
- RtApiDs();
- ~RtApiDs();
- RtAudio::Api getCurrentApi( void ) override { return RtAudio::WINDOWS_DS; }
- unsigned int getDeviceCount( void ) override;
- unsigned int getDefaultOutputDevice( void ) override;
- unsigned int getDefaultInputDevice( void ) override;
- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
- void closeStream( void ) override;
- void startStream( void ) override;
- void stopStream( void ) override;
- void abortStream( void ) override;
-
-
-
-
- void callbackEvent( void );
- private:
- bool coInitialized_;
- bool buffersRolling;
- long duplexPrerollBytes;
- std::vector<struct DsDevice> dsDevices;
- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
- unsigned int firstChannel, unsigned int sampleRate,
- RtAudioFormat format, unsigned int *bufferSize,
- RtAudio::StreamOptions *options ) override;
- };
- #endif
- #if defined(__WINDOWS_WASAPI__)
- struct IMMDeviceEnumerator;
- class RtApiWasapi : public RtApi
- {
- public:
- RtApiWasapi();
- virtual ~RtApiWasapi();
- RtAudio::Api getCurrentApi( void ) override { return RtAudio::WINDOWS_WASAPI; }
- unsigned int getDeviceCount( void ) override;
- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
- void closeStream( void ) override;
- void startStream( void ) override;
- void stopStream( void ) override;
- void abortStream( void ) override;
- private:
- bool coInitialized_;
- IMMDeviceEnumerator* deviceEnumerator_;
- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
- unsigned int firstChannel, unsigned int sampleRate,
- RtAudioFormat format, unsigned int* bufferSize,
- RtAudio::StreamOptions* options ) override;
- static DWORD WINAPI runWasapiThread( void* wasapiPtr );
- static DWORD WINAPI stopWasapiThread( void* wasapiPtr );
- static DWORD WINAPI abortWasapiThread( void* wasapiPtr );
- void wasapiThread();
- };
- #endif
- #if defined(__LINUX_ALSA__)
- class RtApiAlsa: public RtApi
- {
- public:
- RtApiAlsa();
- ~RtApiAlsa();
- RtAudio::Api getCurrentApi() override { return RtAudio::LINUX_ALSA; }
- unsigned int getDeviceCount( void ) override;
- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
- void closeStream( void ) override;
- void startStream( void ) override;
- void stopStream( void ) override;
- void abortStream( void ) override;
-
-
-
-
- void callbackEvent( void );
- private:
- std::vector<RtAudio::DeviceInfo> devices_;
- void saveDeviceInfo( void );
- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
- unsigned int firstChannel, unsigned int sampleRate,
- RtAudioFormat format, unsigned int *bufferSize,
- RtAudio::StreamOptions *options ) override;
- };
- #endif
- #if defined(__LINUX_PULSE__)
- class RtApiPulse: public RtApi
- {
- public:
- ~RtApiPulse();
- RtAudio::Api getCurrentApi() override { return RtAudio::LINUX_PULSE; }
- unsigned int getDeviceCount( void ) override;
- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
- void closeStream( void ) override;
- void startStream( void ) override;
- void stopStream( void ) override;
- void abortStream( void ) override;
-
-
-
-
- void callbackEvent( void );
- private:
- void collectDeviceInfo( void );
- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
- unsigned int firstChannel, unsigned int sampleRate,
- RtAudioFormat format, unsigned int *bufferSize,
- RtAudio::StreamOptions *options ) override;
- };
- #endif
- #if defined(__LINUX_OSS__)
- class RtApiOss: public RtApi
- {
- public:
- RtApiOss();
- ~RtApiOss();
- RtAudio::Api getCurrentApi() override { return RtAudio::LINUX_OSS; }
- unsigned int getDeviceCount( void ) override;
- RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) override;
- void closeStream( void ) override;
- void startStream( void ) override;
- void stopStream( void ) override;
- void abortStream( void ) override;
-
-
-
-
- void callbackEvent( void );
- private:
- bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
- unsigned int firstChannel, unsigned int sampleRate,
- RtAudioFormat format, unsigned int *bufferSize,
- RtAudio::StreamOptions *options ) override;
- };
- #endif
- #if defined(__RTAUDIO_DUMMY__)
- class RtApiDummy: public RtApi
- {
- public:
- RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( RtAudioError::WARNING ); }
- RtAudio::Api getCurrentApi( void ) override { return RtAudio::RTAUDIO_DUMMY; }
- unsigned int getDeviceCount( void ) override { return 0; }
- RtAudio::DeviceInfo getDeviceInfo( unsigned int ) override { RtAudio::DeviceInfo info; return info; }
- void closeStream( void ) override {}
- void startStream( void ) override {}
- void stopStream( void ) override {}
- void abortStream( void ) override {}
- private:
- bool probeDeviceOpen( unsigned int , StreamMode , unsigned int ,
- unsigned int , unsigned int ,
- RtAudioFormat , unsigned int * ,
- RtAudio::StreamOptions * ) override { return false; }
- };
- #endif
- #endif
|