UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RtAudio.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "AudioCaptureCore.h"
5
6#if PLATFORM_MICROSOFT || PLATFORM_MAC
7/************************************************************************/
45/************************************************************************/
46
51#ifndef __RTAUDIO_H
52#define __RTAUDIO_H
53
54// Per-platform preprocessor defines here.
55#if PLATFORM_WINDOWS
57
58#ifndef __WINDOWS_DS__
59#define __WINDOWS_DS__
60#endif // __WINDOWS_DS__
61
62#ifdef __WINDOWS_WASAPI__
63#undef __WINDOWS_WASAPI__
64#endif
65
66#elif PLATFORM_MICROSOFT
67
68// On Xbox, we use WASAPI.
70
71#ifdef __WINDOWS_DS__
72#undef __WINDOWS_DS__
73#endif // __WINDOWS_DS__
74
75#ifndef __WINDOWS_WASAPI__
76#define __WINDOWS_WASAPI__
77#endif
78
79#elif PLATFORM_MAC
80#ifndef __MACOSX_CORE__
81#define __MACOSX_CORE__
82#endif // __MACOSX_CORE__
83#endif // PLATFORM_WINDOWS
84
85#define RTAUDIO_VERSION "5.0.0"
86
87#if defined _WIN32 || defined __CYGWIN__
88 #define RTAUDIO_DLL_PUBLIC
89#else
90 #if __GNUC__ >= 4
91 #define RTAUDIO_DLL_PUBLIC __attribute__( (visibility( "default" )) )
92 #else
93 #define RTAUDIO_DLL_PUBLIC
94 #endif
95#endif
96
98#include <string>
99#include <vector>
100#include <stdexcept>
101#include <iostream>
103
120typedef unsigned long RtAudioFormat;
121static const RtAudioFormat RTAUDIO_SINT8 = 0x1; // 8-bit signed integer.
122static const RtAudioFormat RTAUDIO_SINT16 = 0x2; // 16-bit signed integer.
123static const RtAudioFormat RTAUDIO_SINT24 = 0x4; // 24-bit signed integer.
124static const RtAudioFormat RTAUDIO_SINT32 = 0x8; // 32-bit signed integer.
125static const RtAudioFormat RTAUDIO_FLOAT32 = 0x10; // Normalized between plus/minus 1.0.
126static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/minus 1.0.
127
174typedef unsigned int RtAudioStreamFlags;
175static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1; // Use non-interleaved buffers (default = interleaved).
176static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2; // Attempt to set stream parameters for lowest possible latency.
177static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4; // Attempt grab device and prevent use by others.
178static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8; // Try to select realtime scheduling for callback thread.
179static const RtAudioStreamFlags RTAUDIO_ALSA_USE_DEFAULT = 0x10; // Use the "default" PCM device (ALSA only).
180static const RtAudioStreamFlags RTAUDIO_JACK_DONT_CONNECT = 0x20; // Do not automatically connect ports (JACK only).
181
193typedef unsigned int RtAudioStreamStatus;
194static const RtAudioStreamStatus RTAUDIO_INPUT_OVERFLOW = 0x1; // Input data was discarded because of an overflow condition at the driver.
195static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2; // The output buffer ran low, likely causing a gap in the output sound.
196
198
236typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer,
237 unsigned int nFrames,
238 double streamTime,
239 RtAudioStreamStatus status,
240 void *userData );
241
242/************************************************************************/
250/************************************************************************/
251
252class RtAudioError : public std::runtime_error
253{
254 public:
256 enum Type {
257 WARNING,
268 };
269
271 RtAudioError( const std::string& message,
272 Type type = RtAudioError::UNSPECIFIED )
273 : std::runtime_error(message), type_(type) {}
274
276 virtual void printMessage( void ) const
277 { std::cerr << '\n' << what() << "\n\n"; }
278
280 virtual const Type& getType(void) const { return type_; }
281
283 virtual const std::string getMessage(void) const
284 { return std::string(what()); }
285
286 protected:
287 Type type_;
288};
289
291
295typedef void (*RtAudioErrorCallback)( RtAudioError::Type type, const std::string &errorText );
296
297// **************************************************************** //
298//
299// RtAudio class declaration.
300//
301// RtAudio is a "controller" used to select an available audio i/o
302// interface. It presents a common API for the user to call but all
303// functionality is implemented by the class RtApi and its
304// subclasses. RtAudio creates an instance of an RtApi subclass
305// based on the user's API choice. If no choice is made, RtAudio
306// attempts to make a "logical" API selection.
307//
308// **************************************************************** //
309
310class RtApi;
311
312class RtAudio
313{
314 public:
315
317 enum Api {
319 LINUX_ALSA,
321 LINUX_OSS,
322 UNIX_JACK,
326 WINDOWS_DS,
328 };
329
331 struct DeviceInfo {
332 bool probed;
333 std::string name;
334 std::string deviceId;
335 unsigned int outputChannels;
336 unsigned int inputChannels;
337 unsigned int duplexChannels;
338 bool isDefaultOutput;
339 bool isDefaultInput;
340 std::vector<unsigned int> sampleRates;
341 unsigned int preferredSampleRate;
344 // Default constructor.
345 DeviceInfo()
348 };
349
351 struct StreamParameters {
352 unsigned int deviceId;
353 unsigned int nChannels;
354 unsigned int firstChannel;
356 // Default constructor.
358 : deviceId(0), nChannels(0), firstChannel(0) {}
359 };
360
362
418 struct StreamOptions {
419 RtAudioStreamFlags flags;
420 unsigned int numberOfBuffers;
421 std::string streamName;
422 int priority;
424 // Default constructor.
426 : flags(0), numberOfBuffers(0), priority(0) {}
427 };
428
430 static AUDIOCAPTURERTAUDIO_API std::string getVersion( void );
431
433
438 static AUDIOCAPTURERTAUDIO_API void getCompiledApi( std::vector<RtAudio::Api> &apis );
439
441
450
452
457
459 AUDIOCAPTURERTAUDIO_API RtAudio::Api getCurrentApi( void );
460
462
467 AUDIOCAPTURERTAUDIO_API unsigned int getDeviceCount( void );
468
470
480 AUDIOCAPTURERTAUDIO_API RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
481
483
491
493
501
503
542 AUDIOCAPTURERTAUDIO_API void openStream( RtAudio::StreamParameters *outputParameters,
543 RtAudio::StreamParameters *inputParameters,
544 RtAudioFormat format, unsigned int sampleRate,
546 void *userData = NULL, RtAudio::StreamOptions *options = NULL, RtAudioErrorCallback errorCallback = NULL );
547
549
554
556
563
565
572
574
581
583 AUDIOCAPTURERTAUDIO_API bool isStreamOpen( void ) const;
584
586 AUDIOCAPTURERTAUDIO_API bool isStreamRunning( void ) const;
587
589
593
595
599
601
610
612
617 AUDIOCAPTURERTAUDIO_API unsigned int getStreamSampleRate( void );
618
620 AUDIOCAPTURERTAUDIO_API void showWarnings( bool value = true );
621
622 protected:
623
624 AUDIOCAPTURERTAUDIO_API void openRtApi( RtAudio::Api api );
625 RtApi *rtapi_;
626};
627
628// Operating system dependent thread functionality.
629#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_WASAPI__)
630
631 #ifndef NOMINMAX
632 #define NOMINMAX
633 #endif
634 #include <windows.h>
635 #include <process.h>
636
637 typedef uintptr_t ThreadHandle;
638 typedef CRITICAL_SECTION StreamMutex;
639
640#elif defined(__LINUX_ALSA__) || defined(__LINUX_PULSE__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__)
641 // Using pthread library for various flavors of unix.
642 #include <pthread.h>
643
644 typedef pthread_t ThreadHandle;
646
647#else // Setup for "dummy" behavior
648
649 #define __RTAUDIO_DUMMY__
650 typedef int ThreadHandle;
651 typedef int StreamMutex;
652
653#endif
654
655// This global structure type is used to pass callback information
656// between the private RtAudio stream structure and global callback
657// handling functions.
658struct CallbackInfo {
659 void *object; // Used as a "this" pointer.
660 ThreadHandle thread;
661 void *callback;
662 void *userData;
663 void *errorCallback;
664 void *apiInfo; // void pointer for API specific callback information
665 bool isRunning;
666 bool doRealtime;
667 int priority;
668
669 // Default constructor.
671 :object(0), callback(0), userData(0), errorCallback(0), apiInfo(0), isRunning(false), doRealtime(false), priority(0) {}
672};
673
674// **************************************************************** //
675//
676// RtApi class declaration.
677//
678// Subclasses of RtApi contain all API- and OS-specific code necessary
679// to fully implement the RtAudio API.
680//
681// Note that RtApi is an abstract base class and cannot be
682// explicitly instantiated. The class RtAudio will create an
683// instance of an RtApi subclass (RtApiOss, RtApiAlsa,
684// RtApiJack, RtApiCore, RtApiDs, or RtApiAsio).
685//
686// **************************************************************** //
687
688#pragma pack(push, 1)
689class S24 {
690
691 protected:
692 unsigned char c3[3];
693
694 public:
695 S24() {}
696
697 S24& operator = ( const int& i ) {
698 c3[0] = (i & 0x000000ff);
699 c3[1] = (i & 0x0000ff00) >> 8;
700 c3[2] = (i & 0x00ff0000) >> 16;
701 return *this;
702 }
703
704 S24( const S24& v ) { *this = v; }
705 S24( const double& d ) { *this = (int) d; }
706 S24( const float& f ) { *this = (int) f; }
707 S24( const signed short& s ) { *this = (int) s; }
708 S24( const char& c ) { *this = (int) c; }
709
710 int asInt() {
711 int i = c3[0] | (c3[1] << 8) | (c3[2] << 16);
712 if (i & 0x800000) i |= ~0xffffff;
713 return i;
714 }
715};
716#pragma pack(pop)
717
718#if defined( HAVE_GETTIMEOFDAY )
719 #include <sys/time.h>
720#endif
721
722#include <sstream>
723
724class RtApi
725{
726public:
727
730 virtual RtAudio::Api getCurrentApi( void ) = 0;
731 virtual unsigned int getDeviceCount( void ) = 0;
732 virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0;
733 AUDIOCAPTURERTAUDIO_API virtual unsigned int getDefaultInputDevice( void );
734 AUDIOCAPTURERTAUDIO_API virtual unsigned int getDefaultOutputDevice( void );
735 AUDIOCAPTURERTAUDIO_API void openStream( RtAudio::StreamParameters *outputParameters,
736 RtAudio::StreamParameters *inputParameters,
737 RtAudioFormat format, unsigned int sampleRate,
739 void *userData, RtAudio::StreamOptions *options,
741 AUDIOCAPTURERTAUDIO_API virtual void closeStream( void );
742 virtual void startStream( void ) = 0;
743 virtual void stopStream( void ) = 0;
744 virtual void abortStream( void ) = 0;
746 AUDIOCAPTURERTAUDIO_API unsigned int getStreamSampleRate( void );
747 AUDIOCAPTURERTAUDIO_API virtual double getStreamTime( void );
748 AUDIOCAPTURERTAUDIO_API virtual void setStreamTime( double time );
749 bool isStreamOpen( void ) const { return stream_.state != STREAM_CLOSED; }
750 bool isStreamRunning( void ) const { return stream_.state == STREAM_RUNNING; }
751 void showWarnings( bool value ) { showWarnings_ = value; }
752
753
754protected:
755
756 static AUDIOCAPTURERTAUDIO_API const unsigned int MAX_SAMPLE_RATES;
757 static AUDIOCAPTURERTAUDIO_API const unsigned int SAMPLE_RATES[];
758
759 enum { FAILURE, SUCCESS };
760
761 enum StreamState {
762 STREAM_STOPPED,
763 STREAM_STOPPING,
765 STREAM_CLOSED = -50
766 };
767
768 enum StreamMode {
769 OUTPUT,
770 INPUT,
771 DUPLEX,
772 UNINITIALIZED = -75
773 };
774
775 // A protected structure used for buffer conversion.
776 struct ConvertInfo {
777 int channels;
778 int inJump, outJump;
780 std::vector<int> inOffset;
781 std::vector<int> outOffset;
782 };
783
784 // A protected structure for audio streams.
785 struct RtApiStream {
786 unsigned int device[2]; // Playback and record, respectively.
787 void *apiHandle; // void pointer for API specific stream handle information
788 StreamMode mode; // OUTPUT, INPUT, or DUPLEX.
789 StreamState state; // STOPPED, RUNNING, or CLOSED
790 char *userBuffer[2]; // Playback and record, respectively.
791 char *deviceBuffer;
792 bool doConvertBuffer[2]; // Playback and record, respectively.
793 bool userInterleaved;
794 bool deviceInterleaved[2]; // Playback and record, respectively.
795 bool doByteSwap[2]; // Playback and record, respectively.
796 unsigned int sampleRate;
797 unsigned int bufferSize;
798 unsigned int nBuffers;
799 unsigned int nUserChannels[2]; // Playback and record, respectively.
800 unsigned int nDeviceChannels[2]; // Playback and record channels, respectively.
801 unsigned int channelOffset[2]; // Playback and record, respectively.
802 unsigned long latency[2]; // Playback and record, respectively.
804 RtAudioFormat deviceFormat[2]; // Playback and record, respectively.
808 double streamTime; // Number of elapsed seconds since the stream started.
809
810#if defined(HAVE_GETTIMEOFDAY)
812#endif
813
815 :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; }
816 };
817
818 typedef S24 Int24;
819 typedef signed short Int16;
820 typedef signed int Int32;
821 typedef float Float32;
822 typedef double Float64;
823
824 std::ostringstream errorStream_;
825 std::string errorText_;
826 bool showWarnings_;
829
837 AUDIOCAPTURERTAUDIO_API virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
838 unsigned int firstChannel, unsigned int sampleRate,
839 RtAudioFormat format, unsigned int *bufferSize,
840 RtAudio::StreamOptions *options );
841
844
847
853
855 AUDIOCAPTURERTAUDIO_API void error( RtAudioError::Type type );
856
862
864 AUDIOCAPTURERTAUDIO_API void byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format );
865
868
871};
872
873// **************************************************************** //
874//
875// Inline RtAudio definitions.
876//
877// **************************************************************** //
878
879inline RtAudio::Api RtAudio :: getCurrentApi( void ) { return rtapi_->getCurrentApi(); }
880inline unsigned int RtAudio :: getDeviceCount( void ) { return rtapi_->getDeviceCount(); }
881inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); }
882inline unsigned int RtAudio :: getDefaultInputDevice( void ) { return rtapi_->getDefaultInputDevice(); }
883inline unsigned int RtAudio :: getDefaultOutputDevice( void ) { return rtapi_->getDefaultOutputDevice(); }
884inline void RtAudio :: closeStream( void ) { return rtapi_->closeStream(); }
885inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); }
886inline void RtAudio :: stopStream( void ) { return rtapi_->stopStream(); }
887inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); }
888inline bool RtAudio :: isStreamOpen( void ) const { return rtapi_->isStreamOpen(); }
889inline bool RtAudio :: isStreamRunning( void ) const { return rtapi_->isStreamRunning(); }
890inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); }
891inline unsigned int RtAudio :: getStreamSampleRate( void ) { return rtapi_->getStreamSampleRate(); }
892inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); }
893inline void RtAudio :: setStreamTime( double time ) { return rtapi_->setStreamTime( time ); }
894inline void RtAudio :: showWarnings( bool value ) { rtapi_->showWarnings( value ); }
895
896// RtApi Subclass prototypes.
897
898#if defined(__MACOSX_CORE__)
899
900#include <CoreAudio/AudioHardware.h>
901
902class RtApiCore: public RtApi
903{
904public:
905
906 RtApiCore();
907 ~RtApiCore();
908 RtAudio::Api getCurrentApi( void ) { return RtAudio::MACOSX_CORE; }
909 unsigned int getDeviceCount( void );
910 RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
911 unsigned int getDefaultOutputDevice( void );
912 unsigned int getDefaultInputDevice( void );
913 void closeStream( void );
914 void startStream( void );
915 void stopStream( void );
916 void abortStream( void );
917 long getStreamLatency( void );
918
919 // This function is intended for internal use only. It must be
920 // public because it is called by the internal callback handler,
921 // which is not a member of RtAudio. External use of this function
922 // will most likely produce highly undesireable results!
923 bool callbackEvent( AudioDeviceID deviceId,
926
927 private:
928
929 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
930 unsigned int firstChannel, unsigned int sampleRate,
931 RtAudioFormat format, unsigned int *bufferSize,
932 RtAudio::StreamOptions *options );
933 static const char* getErrorCode( OSStatus code );
934};
935
936#endif
937
938#if defined(__UNIX_JACK__)
939
940class RtApiJack: public RtApi
941{
942public:
943
944 RtApiJack();
945 ~RtApiJack();
946 RtAudio::Api getCurrentApi( void ) { return RtAudio::UNIX_JACK; }
947 unsigned int getDeviceCount( void );
948 RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
949 void closeStream( void );
950 void startStream( void );
951 void stopStream( void );
952 void abortStream( void );
953 long getStreamLatency( void );
954
955 // This function is intended for internal use only. It must be
956 // public because it is called by the internal callback handler,
957 // which is not a member of RtAudio. External use of this function
958 // will most likely produce highly undesireable results!
959 bool callbackEvent( unsigned long nframes );
960
961 private:
962
963 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
964 unsigned int firstChannel, unsigned int sampleRate,
965 RtAudioFormat format, unsigned int *bufferSize,
966 RtAudio::StreamOptions *options );
967
969};
970
971#endif
972
973#if defined(__WINDOWS_ASIO__)
974
975class RtApiAsio: public RtApi
976{
977public:
978
979 RtApiAsio();
980 ~RtApiAsio();
981 RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_ASIO; }
982 unsigned int getDeviceCount( void );
983 RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
984 void closeStream( void );
985 void startStream( void );
986 void stopStream( void );
987 void abortStream( void );
988 long getStreamLatency( void );
989
990 // This function is intended for internal use only. It must be
991 // public because it is called by the internal callback handler,
992 // which is not a member of RtAudio. External use of this function
993 // will most likely produce highly undesireable results!
994 bool callbackEvent( long bufferIndex );
995
996 private:
997
998 std::vector<RtAudio::DeviceInfo> devices_;
999 void saveDeviceInfo( void );
1000 bool coInitialized_;
1001 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
1002 unsigned int firstChannel, unsigned int sampleRate,
1003 RtAudioFormat format, unsigned int *bufferSize,
1004 RtAudio::StreamOptions *options );
1005};
1006
1007#endif
1008
1009#if defined(__WINDOWS_DS__)
1010
1011class RtApiDs: public RtApi
1012{
1013public:
1014
1015 RtApiDs();
1016 ~RtApiDs();
1017 RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_DS; }
1018 unsigned int getDeviceCount( void );
1019 unsigned int getDefaultOutputDevice( void );
1020 unsigned int getDefaultInputDevice( void );
1021 RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
1022 void closeStream( void );
1023 void startStream( void );
1024 void stopStream( void );
1025 void abortStream( void );
1026 long getStreamLatency( void );
1027
1028 // This function is intended for internal use only. It must be
1029 // public because it is called by the internal callback handler,
1030 // which is not a member of RtAudio. External use of this function
1031 // will most likely produce highly undesireable results!
1032 void callbackEvent( void );
1033
1034 private:
1035
1036 bool coInitialized_;
1037 bool buffersRolling;
1038 long duplexPrerollBytes;
1039 std::vector<struct DsDevice> dsDevices;
1040 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
1041 unsigned int firstChannel, unsigned int sampleRate,
1042 RtAudioFormat format, unsigned int *bufferSize,
1043 RtAudio::StreamOptions *options );
1044};
1045
1046#endif
1047
1048#if defined(__WINDOWS_WASAPI__)
1049
1050struct IMMDeviceEnumerator;
1051
1052class RtApiWasapi : public RtApi
1053{
1054public:
1055 RtApiWasapi();
1056 ~RtApiWasapi();
1057
1058 RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_WASAPI; }
1059 unsigned int getDeviceCount( void );
1060 RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
1061 unsigned int getDefaultOutputDevice( void );
1062 unsigned int getDefaultInputDevice( void );
1063 void closeStream( void );
1064 void startStream( void );
1065 void stopStream( void );
1066 void abortStream( void );
1067
1068private:
1069 bool coInitialized_;
1071
1072 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
1073 unsigned int firstChannel, unsigned int sampleRate,
1074 RtAudioFormat format, unsigned int* bufferSize,
1075 RtAudio::StreamOptions* options );
1076
1077 static DWORD WINAPI runWasapiThread( void* wasapiPtr );
1078 static DWORD WINAPI stopWasapiThread( void* wasapiPtr );
1079 static DWORD WINAPI abortWasapiThread( void* wasapiPtr );
1080 void wasapiThread();
1081};
1082
1083#endif
1084
1085#if defined(__LINUX_ALSA__)
1086
1087class RtApiAlsa: public RtApi
1088{
1089public:
1090
1091 RtApiAlsa();
1092 ~RtApiAlsa();
1093 RtAudio::Api getCurrentApi() { return RtAudio::LINUX_ALSA; }
1094 unsigned int getDeviceCount( void );
1095 RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
1096 void closeStream( void );
1097 void startStream( void );
1098 void stopStream( void );
1099 void abortStream( void );
1100
1101 // This function is intended for internal use only. It must be
1102 // public because it is called by the internal callback handler,
1103 // which is not a member of RtAudio. External use of this function
1104 // will most likely produce highly undesireable results!
1105 void callbackEvent( void );
1106
1107 private:
1108
1109 std::vector<RtAudio::DeviceInfo> devices_;
1110 void saveDeviceInfo( void );
1111 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
1112 unsigned int firstChannel, unsigned int sampleRate,
1113 RtAudioFormat format, unsigned int *bufferSize,
1114 RtAudio::StreamOptions *options );
1115};
1116
1117#endif
1118
1119#if defined(__LINUX_PULSE__)
1120
1121class RtApiPulse: public RtApi
1122{
1123public:
1124 ~RtApiPulse();
1125 RtAudio::Api getCurrentApi() { return RtAudio::LINUX_PULSE; }
1126 unsigned int getDeviceCount( void );
1127 RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
1128 void closeStream( void );
1129 void startStream( void );
1130 void stopStream( void );
1131 void abortStream( void );
1132
1133 // This function is intended for internal use only. It must be
1134 // public because it is called by the internal callback handler,
1135 // which is not a member of RtAudio. External use of this function
1136 // will most likely produce highly undesireable results!
1137 void callbackEvent( void );
1138
1139 private:
1140
1141 std::vector<RtAudio::DeviceInfo> devices_;
1142 void saveDeviceInfo( void );
1143 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
1144 unsigned int firstChannel, unsigned int sampleRate,
1145 RtAudioFormat format, unsigned int *bufferSize,
1146 RtAudio::StreamOptions *options );
1147};
1148
1149#endif
1150
1151#if defined(__LINUX_OSS__)
1152
1153class RtApiOss: public RtApi
1154{
1155public:
1156
1157 RtApiOss();
1158 ~RtApiOss();
1159 RtAudio::Api getCurrentApi() { return RtAudio::LINUX_OSS; }
1160 unsigned int getDeviceCount( void );
1161 RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
1162 void closeStream( void );
1163 void startStream( void );
1164 void stopStream( void );
1165 void abortStream( void );
1166
1167 // This function is intended for internal use only. It must be
1168 // public because it is called by the internal callback handler,
1169 // which is not a member of RtAudio. External use of this function
1170 // will most likely produce highly undesireable results!
1171 void callbackEvent( void );
1172
1173 private:
1174
1175 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels,
1176 unsigned int firstChannel, unsigned int sampleRate,
1177 RtAudioFormat format, unsigned int *bufferSize,
1178 RtAudio::StreamOptions *options );
1179};
1180
1181#endif
1182
1183#if defined(__RTAUDIO_DUMMY__)
1184
1185class RtApiDummy: public RtApi
1186{
1187public:
1188
1189 RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( RtAudioError::WARNING ); }
1190 RtAudio::Api getCurrentApi( void ) { return RtAudio::RTAUDIO_DUMMY; }
1191 unsigned int getDeviceCount( void ) { return 0; }
1192 RtAudio::DeviceInfo getDeviceInfo( unsigned int /*device*/ ) { RtAudio::DeviceInfo info; return info; }
1193 void closeStream( void ) {}
1194 void startStream( void ) {}
1195 void stopStream( void ) {}
1196 void abortStream( void ) {}
1197
1198 private:
1199
1200 bool probeDeviceOpen( unsigned int /*device*/, StreamMode /*mode*/, unsigned int /*channels*/,
1201 unsigned int /*firstChannel*/, unsigned int /*sampleRate*/,
1202 RtAudioFormat /*format*/, unsigned int * /*bufferSize*/,
1203 RtAudio::StreamOptions * /*options*/ ) { return false; }
1204};
1205
1206#endif
1207
1208#endif
1209
1210// Indentation settings for Vim and Emacs
1211//
1212// Local Variables:
1213// c-basic-offset: 2
1214// indent-tabs-mode: nil
1215// End:
1216//
1217// vim: et sts=2 sw=2
1218#endif // PLATFORM_WINDOWS
OODEFFUNC typedef const int const char const char * message
Definition oodle2.h:710
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define NULL
Definition oodle2base.h:134
EGLSurface EGLnsecsANDROID time
Definition AndroidOpenGLFunctions.h:9
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define THIRD_PARTY_INCLUDES_START
Definition GenericPlatformCompilerPreSetup.h:63
#define WINAPI
Definition MinimalWindowsApi.h:58
char * inputBuffer
Definition lz4.h:731
@ UNINITIALIZED
Definition SoundFileIOEnums.h:243
Type
Definition PawnAction_Move.h:11
Definition Voronoi.cpp:10
type
Definition TestServer.py:515
int
Definition TestServer.py:515
mode
Definition VerseGrammar.h:91
unsigned long DWORD
Definition MinimalWindowsApi.h:67
@ false
Definition radaudio_common.h:23
float v
Definition radaudio_mdct.cpp:62