diff --git a/configure b/configure index 1f88ae3..52e9e29 100755 --- a/configure +++ b/configure @@ -671,7 +671,6 @@ EGREP cppflag cxxflag object_path -api build build_cpu build_vendor @@ -680,6 +679,10 @@ host host_cpu host_vendor host_os +sharedlib +sharedname +libflags +api objects LIBOBJS LTLIBOBJS' @@ -4099,9 +4102,6 @@ fi CXXFLAGS="$CXXFLAGS $cxxflag" -# Checks for package options and external software -api="" - # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 @@ -4185,6 +4185,26 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + +sharedlib="librtaudio.so" + +sharedname="librtaudio.so.\$(RELEASE)" + +libflags="-shared -Wl,-soname,\$(SHAREDLIB).\$(MAJOR) -o \$(SHAREDLIB).\$(RELEASE)" + +case $host in + *-apple*) + sharedlib="librtaudio.dylib" + + sharedname="librtaudio.\$(RELEASE).dylib" + + libflags="-dynamiclib -o librtaudio.\$(RELEASE).dylib" + +esac + +# Checks for package options and external software +api="" + { echo "$as_me:$LINENO: checking for audio API" >&5 echo $ECHO_N "checking for audio API... $ECHO_C" >&6; } case $host in @@ -5888,7 +5908,6 @@ EGREP!$EGREP$ac_delim cppflag!$cppflag$ac_delim cxxflag!$cxxflag$ac_delim object_path!$object_path$ac_delim -api!$api$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim @@ -5897,12 +5916,16 @@ host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim +sharedlib!$sharedlib$ac_delim +sharedname!$sharedname$ac_delim +libflags!$libflags$ac_delim +api!$api$ac_delim objects!$objects$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 68; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/doc/html/RtAudio_8h.html b/doc/html/RtAudio_8h.html index bf3d222..d361bde 100644 --- a/doc/html/RtAudio_8h.html +++ b/doc/html/RtAudio_8h.html @@ -50,11 +50,11 @@
RtAudio data format type.
-Support for signed integers and floats. Audio data fed to/from an RtAudio stream is assumed to ALWAYS be in host byte order. The internal routines will automatically take care of any necessary byte-swapping between the host format and the soundcard. Thus, endian-ness is not a concern in the following format definitions.
+Support for signed integers and floats. Audio data fed to/from an RtAudio stream is assumed to ALWAYS be in host byte order. The internal routines will automatically take care of any necessary byte-swapping between the host format and the soundcard. Thus, endian-ness is not a concern in the following format definitions. Note that 24-bit data is expected to be encapsulated in a 32-bit format.
By default, RtAudio streams pass and receive audio data from the client in an interleaved format. By passing the RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio data will instead be presented in non-interleaved buffers. In this case, each buffer argument in the RtAudioCallback function will point to a single array of data, with nFrames
samples for each channel concatenated back-to-back. For example, the first sample of data for the second channel would be located at index nFrames
(assuming the buffer
pointer was recast to the correct data type for the stream).
Certain audio APIs offer a number of parameters that influence the I/O latency of a stream. By default, RtAudio will attempt to set these parameters internally for robust (glitch-free) performance (though some APIs, like Windows Direct Sound, make this difficult). By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream() function, internal stream settings will be influenced in an attempt to minimize stream latency, though possibly at the expense of stream performance.
If the RTAUDIO_HOG_DEVICE flag is set, RtAudio will attempt to open the input and/or output stream device(s) for exclusive use. Note that this is not possible with all supported audio APIs.
-If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt to select realtime scheduling (round-robin) for the callback thread.
+If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt to select realtime scheduling (round-robin) for the callback thread.
+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.
00001 /************************************************************************/ 00039 /************************************************************************/ 00040 -00045 // RtAudio: Version 4.0.7 +00045 // RtAudio: Version 4.0.8 00046 00047 #ifndef __RTAUDIO_H 00048 #define __RTAUDIO_H @@ -21,615 +21,616 @@ 00051 #include <vector> 00052 #include "RtError.h" 00053 -00070 typedef unsigned long RtAudioFormat; -00071 static const RtAudioFormat RTAUDIO_SINT8 = 0x1; // 8-bit signed integer. -00072 static const RtAudioFormat RTAUDIO_SINT16 = 0x2; // 16-bit signed integer. -00073 static const RtAudioFormat RTAUDIO_SINT24 = 0x4; // Lower 3 bytes of 32-bit signed integer. -00074 static const RtAudioFormat RTAUDIO_SINT32 = 0x8; // 32-bit signed integer. -00075 static const RtAudioFormat RTAUDIO_FLOAT32 = 0x10; // Normalized between plus/minus 1.0. -00076 static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/minus 1.0. -00077 -00115 typedef unsigned int RtAudioStreamFlags; -00116 static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1; // Use non-interleaved buffers (default = interleaved). -00117 static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2; // Attempt to set stream parameters for lowest possible latency. -00118 static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4; // Attempt grab device and prevent use by others. -00119 static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8; // Try to select realtime scheduling for callback thread. -00120 -00132 typedef unsigned int RtAudioStreamStatus; -00133 static const RtAudioStreamStatus RTAUDIO_INPUT_OVERFLOW = 0x1; // Input data was discarded because of an overflow condition at the driver. -00134 static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2; // The output buffer ran low, likely causing a gap in the output sound. -00135 -00137 -00175 typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer, -00176 unsigned int nFrames, -00177 double streamTime, -00178 RtAudioStreamStatus status, -00179 void *userData ); -00180 -00181 -00182 // **************************************************************** // -00183 // -00184 // RtAudio class declaration. -00185 // -00186 // RtAudio is a "controller" used to select an available audio i/o -00187 // interface. It presents a common API for the user to call but all -00188 // functionality is implemented by the class RtApi and its -00189 // subclasses. RtAudio creates an instance of an RtApi subclass -00190 // based on the user's API choice. If no choice is made, RtAudio -00191 // attempts to make a "logical" API selection. -00192 // -00193 // **************************************************************** // -00194 -00195 class RtApi; -00196 -00197 class RtAudio -00198 { -00199 public: -00200 -00202 enum Api { -00203 UNSPECIFIED, -00204 LINUX_ALSA, -00205 LINUX_OSS, -00206 UNIX_JACK, -00207 MACOSX_CORE, -00208 WINDOWS_ASIO, -00209 WINDOWS_DS, -00210 RTAUDIO_DUMMY -00211 }; -00212 -00214 struct DeviceInfo { -00215 bool probed; -00216 std::string name; -00217 unsigned int outputChannels; -00218 unsigned int inputChannels; -00219 unsigned int duplexChannels; -00220 bool isDefaultOutput; -00221 bool isDefaultInput; -00222 std::vector<unsigned int> sampleRates; -00223 RtAudioFormat nativeFormats; -00225 // Default constructor. -00226 DeviceInfo() -00227 :probed(false), outputChannels(0), inputChannels(0), duplexChannels(0), -00228 isDefaultOutput(false), isDefaultInput(false), nativeFormats(0) {} -00229 }; -00230 -00232 struct StreamParameters { -00233 unsigned int deviceId; -00234 unsigned int nChannels; -00235 unsigned int firstChannel; -00237 // Default constructor. -00238 StreamParameters() -00239 : deviceId(0), nChannels(0), firstChannel(0) {} -00240 }; -00241 -00243 -00294 struct StreamOptions { -00295 RtAudioStreamFlags flags; -00296 unsigned int numberOfBuffers; -00297 std::string streamName; -00298 int priority; -00300 // Default constructor. -00301 StreamOptions() -00302 : flags(0), numberOfBuffers(0), priority(0) {} -00303 }; -00304 -00306 -00311 static void getCompiledApi( std::vector<RtAudio::Api> &apis ) throw(); -00312 -00314 -00322 RtAudio( RtAudio::Api api=UNSPECIFIED ) throw(); -00323 +00072 typedef unsigned long RtAudioFormat; +00073 static const RtAudioFormat RTAUDIO_SINT8 = 0x1; // 8-bit signed integer. +00074 static const RtAudioFormat RTAUDIO_SINT16 = 0x2; // 16-bit signed integer. +00075 static const RtAudioFormat RTAUDIO_SINT24 = 0x4; // Lower 3 bytes of 32-bit signed integer. +00076 static const RtAudioFormat RTAUDIO_SINT32 = 0x8; // 32-bit signed integer. +00077 static const RtAudioFormat RTAUDIO_FLOAT32 = 0x10; // Normalized between plus/minus 1.0. +00078 static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/minus 1.0. +00079 +00122 typedef unsigned int RtAudioStreamFlags; +00123 static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1; // Use non-interleaved buffers (default = interleaved). +00124 static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2; // Attempt to set stream parameters for lowest possible latency. +00125 static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4; // Attempt grab device and prevent use by others. +00126 static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8; // Try to select realtime scheduling for callback thread. +00127 static const RtAudioStreamFlags RTAUDIO_ALSA_USE_DEFAULT = 0x10; // Use the "default" PCM device (ALSA only). +00128 +00140 typedef unsigned int RtAudioStreamStatus; +00141 static const RtAudioStreamStatus RTAUDIO_INPUT_OVERFLOW = 0x1; // Input data was discarded because of an overflow condition at the driver. +00142 static const RtAudioStreamStatus RTAUDIO_OUTPUT_UNDERFLOW = 0x2; // The output buffer ran low, likely causing a gap in the output sound. +00143 +00145 +00183 typedef int (*RtAudioCallback)( void *outputBuffer, void *inputBuffer, +00184 unsigned int nFrames, +00185 double streamTime, +00186 RtAudioStreamStatus status, +00187 void *userData ); +00188 +00189 +00190 // **************************************************************** // +00191 // +00192 // RtAudio class declaration. +00193 // +00194 // RtAudio is a "controller" used to select an available audio i/o +00195 // interface. It presents a common API for the user to call but all +00196 // functionality is implemented by the class RtApi and its +00197 // subclasses. RtAudio creates an instance of an RtApi subclass +00198 // based on the user's API choice. If no choice is made, RtAudio +00199 // attempts to make a "logical" API selection. +00200 // +00201 // **************************************************************** // +00202 +00203 class RtApi; +00204 +00205 class RtAudio +00206 { +00207 public: +00208 +00210 enum Api { +00211 UNSPECIFIED, +00212 LINUX_ALSA, +00213 LINUX_OSS, +00214 UNIX_JACK, +00215 MACOSX_CORE, +00216 WINDOWS_ASIO, +00217 WINDOWS_DS, +00218 RTAUDIO_DUMMY +00219 }; +00220 +00222 struct DeviceInfo { +00223 bool probed; +00224 std::string name; +00225 unsigned int outputChannels; +00226 unsigned int inputChannels; +00227 unsigned int duplexChannels; +00228 bool isDefaultOutput; +00229 bool isDefaultInput; +00230 std::vector<unsigned int> sampleRates; +00231 RtAudioFormat nativeFormats; +00233 // Default constructor. +00234 DeviceInfo() +00235 :probed(false), outputChannels(0), inputChannels(0), duplexChannels(0), +00236 isDefaultOutput(false), isDefaultInput(false), nativeFormats(0) {} +00237 }; +00238 +00240 struct StreamParameters { +00241 unsigned int deviceId; +00242 unsigned int nChannels; +00243 unsigned int firstChannel; +00245 // Default constructor. +00246 StreamParameters() +00247 : deviceId(0), nChannels(0), firstChannel(0) {} +00248 }; +00249 +00251 +00307 struct StreamOptions { +00308 RtAudioStreamFlags flags; +00309 unsigned int numberOfBuffers; +00310 std::string streamName; +00311 int priority; +00313 // Default constructor. +00314 StreamOptions() +00315 : flags(0), numberOfBuffers(0), priority(0) {} +00316 }; +00317 +00319 +00324 static void getCompiledApi( std::vector<RtAudio::Api> &apis ) throw(); 00325 -00329 ~RtAudio() throw(); -00330 -00332 RtAudio::Api getCurrentApi( void ) throw(); -00333 -00335 -00340 unsigned int getDeviceCount( void ) throw(); -00341 +00327 +00335 RtAudio( RtAudio::Api api=UNSPECIFIED ) throw(); +00336 +00338 +00342 ~RtAudio() throw(); 00343 -00353 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +00345 RtAudio::Api getCurrentApi( void ) throw(); +00346 +00348 +00353 unsigned int getDeviceCount( void ) throw(); 00354 00356 -00363 unsigned int getDefaultOutputDevice( void ) throw(); -00364 -00366 -00373 unsigned int getDefaultInputDevice( void ) throw(); -00374 -00376 -00413 void openStream( RtAudio::StreamParameters *outputParameters, -00414 RtAudio::StreamParameters *inputParameters, -00415 RtAudioFormat format, unsigned int sampleRate, -00416 unsigned int *bufferFrames, RtAudioCallback callback, -00417 void *userData = NULL, RtAudio::StreamOptions *options = NULL ); -00418 -00420 -00424 void closeStream( void ) throw(); -00425 -00427 -00433 void startStream( void ); -00434 -00436 -00442 void stopStream( void ); -00443 -00445 -00451 void abortStream( void ); -00452 -00454 bool isStreamOpen( void ) const throw(); -00455 -00457 bool isStreamRunning( void ) const throw(); +00366 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +00367 +00369 +00376 unsigned int getDefaultOutputDevice( void ) throw(); +00377 +00379 +00386 unsigned int getDefaultInputDevice( void ) throw(); +00387 +00389 +00426 void openStream( RtAudio::StreamParameters *outputParameters, +00427 RtAudio::StreamParameters *inputParameters, +00428 RtAudioFormat format, unsigned int sampleRate, +00429 unsigned int *bufferFrames, RtAudioCallback callback, +00430 void *userData = NULL, RtAudio::StreamOptions *options = NULL ); +00431 +00433 +00437 void closeStream( void ) throw(); +00438 +00440 +00446 void startStream( void ); +00447 +00449 +00455 void stopStream( void ); +00456 00458 -00460 -00463 double getStreamTime( void ); -00464 -00466 -00474 long getStreamLatency( void ); -00475 +00464 void abortStream( void ); +00465 +00467 bool isStreamOpen( void ) const throw(); +00468 +00470 bool isStreamRunning( void ) const throw(); +00471 +00473 +00476 double getStreamTime( void ); 00477 -00482 unsigned int getStreamSampleRate( void ); -00483 -00485 void showWarnings( bool value = true ) throw(); -00486 -00487 protected: +00479 +00487 long getStreamLatency( void ); 00488 -00489 void openRtApi( RtAudio::Api api ); -00490 RtApi *rtapi_; -00491 }; -00492 -00493 // Operating system dependent thread functionality. -00494 #if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) -00495 #include <windows.h> -00496 #include <process.h> -00497 -00498 typedef unsigned long ThreadHandle; -00499 typedef CRITICAL_SECTION StreamMutex; -00500 -00501 #elif defined(__LINUX_ALSA__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__) -00502 // Using pthread library for various flavors of unix. -00503 #include <pthread.h> -00504 -00505 typedef pthread_t ThreadHandle; -00506 typedef pthread_mutex_t StreamMutex; -00507 -00508 #else // Setup for "dummy" behavior -00509 -00510 #define __RTAUDIO_DUMMY__ -00511 typedef int ThreadHandle; -00512 typedef int StreamMutex; +00490 +00495 unsigned int getStreamSampleRate( void ); +00496 +00498 void showWarnings( bool value = true ) throw(); +00499 +00500 protected: +00501 +00502 void openRtApi( RtAudio::Api api ); +00503 RtApi *rtapi_; +00504 }; +00505 +00506 // Operating system dependent thread functionality. +00507 #if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) +00508 #include <windows.h> +00509 #include <process.h> +00510 +00511 typedef unsigned long ThreadHandle; +00512 typedef CRITICAL_SECTION StreamMutex; 00513 -00514 #endif -00515 -00516 // This global structure type is used to pass callback information -00517 // between the private RtAudio stream structure and global callback -00518 // handling functions. -00519 struct CallbackInfo { -00520 void *object; // Used as a "this" pointer. -00521 ThreadHandle thread; -00522 void *callback; -00523 void *userData; -00524 void *apiInfo; // void pointer for API specific callback information -00525 bool isRunning; +00514 #elif defined(__LINUX_ALSA__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__) +00515 // Using pthread library for various flavors of unix. +00516 #include <pthread.h> +00517 +00518 typedef pthread_t ThreadHandle; +00519 typedef pthread_mutex_t StreamMutex; +00520 +00521 #else // Setup for "dummy" behavior +00522 +00523 #define __RTAUDIO_DUMMY__ +00524 typedef int ThreadHandle; +00525 typedef int StreamMutex; 00526 -00527 // Default constructor. -00528 CallbackInfo() -00529 :object(0), callback(0), userData(0), apiInfo(0), isRunning(false) {} -00530 }; -00531 -00532 // **************************************************************** // -00533 // -00534 // RtApi class declaration. -00535 // -00536 // Subclasses of RtApi contain all API- and OS-specific code necessary -00537 // to fully implement the RtAudio API. -00538 // -00539 // Note that RtApi is an abstract base class and cannot be -00540 // explicitly instantiated. The class RtAudio will create an -00541 // instance of an RtApi subclass (RtApiOss, RtApiAlsa, -00542 // RtApiJack, RtApiCore, RtApiAl, RtApiDs, or RtApiAsio). -00543 // -00544 // **************************************************************** // -00545 -00546 #if defined( HAVE_GETTIMEOFDAY ) -00547 #include <sys/time.h> -00548 #endif -00549 -00550 #include <sstream> -00551 -00552 class RtApi -00553 { -00554 public: -00555 -00556 RtApi(); -00557 virtual ~RtApi(); -00558 virtual RtAudio::Api getCurrentApi( void ) = 0; -00559 virtual unsigned int getDeviceCount( void ) = 0; -00560 virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0; -00561 virtual unsigned int getDefaultInputDevice( void ); -00562 virtual unsigned int getDefaultOutputDevice( void ); -00563 void openStream( RtAudio::StreamParameters *outputParameters, -00564 RtAudio::StreamParameters *inputParameters, -00565 RtAudioFormat format, unsigned int sampleRate, -00566 unsigned int *bufferFrames, RtAudioCallback callback, -00567 void *userData, RtAudio::StreamOptions *options ); -00568 virtual void closeStream( void ); -00569 virtual void startStream( void ) = 0; -00570 virtual void stopStream( void ) = 0; -00571 virtual void abortStream( void ) = 0; -00572 long getStreamLatency( void ); -00573 unsigned int getStreamSampleRate( void ); -00574 virtual double getStreamTime( void ); -00575 bool isStreamOpen( void ) const { return stream_.state != STREAM_CLOSED; }; -00576 bool isStreamRunning( void ) const { return stream_.state == STREAM_RUNNING; }; -00577 void showWarnings( bool value ) { showWarnings_ = value; }; -00578 -00579 -00580 protected: -00581 -00582 static const unsigned int MAX_SAMPLE_RATES; -00583 static const unsigned int SAMPLE_RATES[]; -00584 -00585 enum { FAILURE, SUCCESS }; -00586 -00587 enum StreamState { -00588 STREAM_STOPPED, -00589 STREAM_RUNNING, -00590 STREAM_CLOSED = -50 -00591 }; +00527 #endif +00528 +00529 // This global structure type is used to pass callback information +00530 // between the private RtAudio stream structure and global callback +00531 // handling functions. +00532 struct CallbackInfo { +00533 void *object; // Used as a "this" pointer. +00534 ThreadHandle thread; +00535 void *callback; +00536 void *userData; +00537 void *apiInfo; // void pointer for API specific callback information +00538 bool isRunning; +00539 +00540 // Default constructor. +00541 CallbackInfo() +00542 :object(0), callback(0), userData(0), apiInfo(0), isRunning(false) {} +00543 }; +00544 +00545 // **************************************************************** // +00546 // +00547 // RtApi class declaration. +00548 // +00549 // Subclasses of RtApi contain all API- and OS-specific code necessary +00550 // to fully implement the RtAudio API. +00551 // +00552 // Note that RtApi is an abstract base class and cannot be +00553 // explicitly instantiated. The class RtAudio will create an +00554 // instance of an RtApi subclass (RtApiOss, RtApiAlsa, +00555 // RtApiJack, RtApiCore, RtApiAl, RtApiDs, or RtApiAsio). +00556 // +00557 // **************************************************************** // +00558 +00559 #if defined( HAVE_GETTIMEOFDAY ) +00560 #include <sys/time.h> +00561 #endif +00562 +00563 #include <sstream> +00564 +00565 class RtApi +00566 { +00567 public: +00568 +00569 RtApi(); +00570 virtual ~RtApi(); +00571 virtual RtAudio::Api getCurrentApi( void ) = 0; +00572 virtual unsigned int getDeviceCount( void ) = 0; +00573 virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0; +00574 virtual unsigned int getDefaultInputDevice( void ); +00575 virtual unsigned int getDefaultOutputDevice( void ); +00576 void openStream( RtAudio::StreamParameters *outputParameters, +00577 RtAudio::StreamParameters *inputParameters, +00578 RtAudioFormat format, unsigned int sampleRate, +00579 unsigned int *bufferFrames, RtAudioCallback callback, +00580 void *userData, RtAudio::StreamOptions *options ); +00581 virtual void closeStream( void ); +00582 virtual void startStream( void ) = 0; +00583 virtual void stopStream( void ) = 0; +00584 virtual void abortStream( void ) = 0; +00585 long getStreamLatency( void ); +00586 unsigned int getStreamSampleRate( void ); +00587 virtual double getStreamTime( void ); +00588 bool isStreamOpen( void ) const { return stream_.state != STREAM_CLOSED; }; +00589 bool isStreamRunning( void ) const { return stream_.state == STREAM_RUNNING; }; +00590 void showWarnings( bool value ) { showWarnings_ = value; }; +00591 00592 -00593 enum StreamMode { -00594 OUTPUT, -00595 INPUT, -00596 DUPLEX, -00597 UNINITIALIZED = -75 -00598 }; +00593 protected: +00594 +00595 static const unsigned int MAX_SAMPLE_RATES; +00596 static const unsigned int SAMPLE_RATES[]; +00597 +00598 enum { FAILURE, SUCCESS }; 00599 -00600 // A protected structure used for buffer conversion. -00601 struct ConvertInfo { -00602 int channels; -00603 int inJump, outJump; -00604 RtAudioFormat inFormat, outFormat; -00605 std::vector<int> inOffset; -00606 std::vector<int> outOffset; -00607 }; -00608 -00609 // A protected structure for audio streams. -00610 struct RtApiStream { -00611 unsigned int device[2]; // Playback and record, respectively. -00612 void *apiHandle; // void pointer for API specific stream handle information -00613 StreamMode mode; // OUTPUT, INPUT, or DUPLEX. -00614 StreamState state; // STOPPED, RUNNING, or CLOSED -00615 char *userBuffer[2]; // Playback and record, respectively. -00616 char *deviceBuffer; -00617 bool doConvertBuffer[2]; // Playback and record, respectively. -00618 bool userInterleaved; -00619 bool deviceInterleaved[2]; // Playback and record, respectively. -00620 bool doByteSwap[2]; // Playback and record, respectively. -00621 unsigned int sampleRate; -00622 unsigned int bufferSize; -00623 unsigned int nBuffers; -00624 unsigned int nUserChannels[2]; // Playback and record, respectively. -00625 unsigned int nDeviceChannels[2]; // Playback and record channels, respectively. -00626 unsigned int channelOffset[2]; // Playback and record, respectively. -00627 unsigned long latency[2]; // Playback and record, respectively. -00628 RtAudioFormat userFormat; -00629 RtAudioFormat deviceFormat[2]; // Playback and record, respectively. -00630 StreamMutex mutex; -00631 CallbackInfo callbackInfo; -00632 ConvertInfo convertInfo[2]; -00633 double streamTime; // Number of elapsed seconds since the stream started. -00634 -00635 #if defined(HAVE_GETTIMEOFDAY) -00636 struct timeval lastTickTimestamp; -00637 #endif -00638 -00639 RtApiStream() -00640 :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; } -00641 }; -00642 -00643 typedef signed short Int16; -00644 typedef signed int Int32; -00645 typedef float Float32; -00646 typedef double Float64; +00600 enum StreamState { +00601 STREAM_STOPPED, +00602 STREAM_RUNNING, +00603 STREAM_CLOSED = -50 +00604 }; +00605 +00606 enum StreamMode { +00607 OUTPUT, +00608 INPUT, +00609 DUPLEX, +00610 UNINITIALIZED = -75 +00611 }; +00612 +00613 // A protected structure used for buffer conversion. +00614 struct ConvertInfo { +00615 int channels; +00616 int inJump, outJump; +00617 RtAudioFormat inFormat, outFormat; +00618 std::vector<int> inOffset; +00619 std::vector<int> outOffset; +00620 }; +00621 +00622 // A protected structure for audio streams. +00623 struct RtApiStream { +00624 unsigned int device[2]; // Playback and record, respectively. +00625 void *apiHandle; // void pointer for API specific stream handle information +00626 StreamMode mode; // OUTPUT, INPUT, or DUPLEX. +00627 StreamState state; // STOPPED, RUNNING, or CLOSED +00628 char *userBuffer[2]; // Playback and record, respectively. +00629 char *deviceBuffer; +00630 bool doConvertBuffer[2]; // Playback and record, respectively. +00631 bool userInterleaved; +00632 bool deviceInterleaved[2]; // Playback and record, respectively. +00633 bool doByteSwap[2]; // Playback and record, respectively. +00634 unsigned int sampleRate; +00635 unsigned int bufferSize; +00636 unsigned int nBuffers; +00637 unsigned int nUserChannels[2]; // Playback and record, respectively. +00638 unsigned int nDeviceChannels[2]; // Playback and record channels, respectively. +00639 unsigned int channelOffset[2]; // Playback and record, respectively. +00640 unsigned long latency[2]; // Playback and record, respectively. +00641 RtAudioFormat userFormat; +00642 RtAudioFormat deviceFormat[2]; // Playback and record, respectively. +00643 StreamMutex mutex; +00644 CallbackInfo callbackInfo; +00645 ConvertInfo convertInfo[2]; +00646 double streamTime; // Number of elapsed seconds since the stream started. 00647 -00648 std::ostringstream errorStream_; -00649 std::string errorText_; -00650 bool showWarnings_; -00651 RtApiStream stream_; -00652 -00660 virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, -00661 unsigned int firstChannel, unsigned int sampleRate, -00662 RtAudioFormat format, unsigned int *bufferSize, -00663 RtAudio::StreamOptions *options ); -00664 -00666 void tickStreamTime( void ); -00667 -00669 void clearStreamInfo(); -00670 -00675 void verifyStream( void ); -00676 -00678 void error( RtError::Type type ); -00679 -00684 void convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info ); -00685 -00687 void byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format ); -00688 -00690 unsigned int formatBytes( RtAudioFormat format ); -00691 -00693 void setConvertInfo( StreamMode mode, unsigned int firstChannel ); -00694 }; -00695 -00696 // **************************************************************** // -00697 // -00698 // Inline RtAudio definitions. -00699 // -00700 // **************************************************************** // +00648 #if defined(HAVE_GETTIMEOFDAY) +00649 struct timeval lastTickTimestamp; +00650 #endif +00651 +00652 RtApiStream() +00653 :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; } +00654 }; +00655 +00656 typedef signed short Int16; +00657 typedef signed int Int32; +00658 typedef float Float32; +00659 typedef double Float64; +00660 +00661 std::ostringstream errorStream_; +00662 std::string errorText_; +00663 bool showWarnings_; +00664 RtApiStream stream_; +00665 +00673 virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +00674 unsigned int firstChannel, unsigned int sampleRate, +00675 RtAudioFormat format, unsigned int *bufferSize, +00676 RtAudio::StreamOptions *options ); +00677 +00679 void tickStreamTime( void ); +00680 +00682 void clearStreamInfo(); +00683 +00688 void verifyStream( void ); +00689 +00691 void error( RtError::Type type ); +00692 +00697 void convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info ); +00698 +00700 void byteSwapBuffer( char *buffer, unsigned int samples, RtAudioFormat format ); 00701 -00702 inline RtAudio::Api RtAudio :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); } -00703 inline unsigned int RtAudio :: getDeviceCount( void ) throw() { return rtapi_->getDeviceCount(); } -00704 inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); } -00705 inline unsigned int RtAudio :: getDefaultInputDevice( void ) throw() { return rtapi_->getDefaultInputDevice(); } -00706 inline unsigned int RtAudio :: getDefaultOutputDevice( void ) throw() { return rtapi_->getDefaultOutputDevice(); } -00707 inline void RtAudio :: closeStream( void ) throw() { return rtapi_->closeStream(); } -00708 inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); } -00709 inline void RtAudio :: stopStream( void ) { return rtapi_->stopStream(); } -00710 inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); } -00711 inline bool RtAudio :: isStreamOpen( void ) const throw() { return rtapi_->isStreamOpen(); } -00712 inline bool RtAudio :: isStreamRunning( void ) const throw() { return rtapi_->isStreamRunning(); } -00713 inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); } -00714 inline unsigned int RtAudio :: getStreamSampleRate( void ) { return rtapi_->getStreamSampleRate(); }; -00715 inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); } -00716 inline void RtAudio :: showWarnings( bool value ) throw() { rtapi_->showWarnings( value ); } -00717 -00718 // RtApi Subclass prototypes. -00719 -00720 #if defined(__MACOSX_CORE__) -00721 -00722 #include <CoreAudio/AudioHardware.h> -00723 -00724 class RtApiCore: public RtApi -00725 { -00726 public: -00727 -00728 RtApiCore(); -00729 ~RtApiCore(); -00730 RtAudio::Api getCurrentApi( void ) { return RtAudio::MACOSX_CORE; }; -00731 unsigned int getDeviceCount( void ); -00732 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); -00733 unsigned int getDefaultOutputDevice( void ); -00734 unsigned int getDefaultInputDevice( void ); -00735 void closeStream( void ); -00736 void startStream( void ); -00737 void stopStream( void ); -00738 void abortStream( void ); -00739 long getStreamLatency( void ); +00703 unsigned int formatBytes( RtAudioFormat format ); +00704 +00706 void setConvertInfo( StreamMode mode, unsigned int firstChannel ); +00707 }; +00708 +00709 // **************************************************************** // +00710 // +00711 // Inline RtAudio definitions. +00712 // +00713 // **************************************************************** // +00714 +00715 inline RtAudio::Api RtAudio :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); } +00716 inline unsigned int RtAudio :: getDeviceCount( void ) throw() { return rtapi_->getDeviceCount(); } +00717 inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); } +00718 inline unsigned int RtAudio :: getDefaultInputDevice( void ) throw() { return rtapi_->getDefaultInputDevice(); } +00719 inline unsigned int RtAudio :: getDefaultOutputDevice( void ) throw() { return rtapi_->getDefaultOutputDevice(); } +00720 inline void RtAudio :: closeStream( void ) throw() { return rtapi_->closeStream(); } +00721 inline void RtAudio :: startStream( void ) { return rtapi_->startStream(); } +00722 inline void RtAudio :: stopStream( void ) { return rtapi_->stopStream(); } +00723 inline void RtAudio :: abortStream( void ) { return rtapi_->abortStream(); } +00724 inline bool RtAudio :: isStreamOpen( void ) const throw() { return rtapi_->isStreamOpen(); } +00725 inline bool RtAudio :: isStreamRunning( void ) const throw() { return rtapi_->isStreamRunning(); } +00726 inline long RtAudio :: getStreamLatency( void ) { return rtapi_->getStreamLatency(); } +00727 inline unsigned int RtAudio :: getStreamSampleRate( void ) { return rtapi_->getStreamSampleRate(); }; +00728 inline double RtAudio :: getStreamTime( void ) { return rtapi_->getStreamTime(); } +00729 inline void RtAudio :: showWarnings( bool value ) throw() { rtapi_->showWarnings( value ); } +00730 +00731 // RtApi Subclass prototypes. +00732 +00733 #if defined(__MACOSX_CORE__) +00734 +00735 #include <CoreAudio/AudioHardware.h> +00736 +00737 class RtApiCore: public RtApi +00738 { +00739 public: 00740 -00741 // This function is intended for internal use only. It must be -00742 // public because it is called by the internal callback handler, -00743 // which is not a member of RtAudio. External use of this function -00744 // will most likely produce highly undesireable results! -00745 bool callbackEvent( AudioDeviceID deviceId, -00746 const AudioBufferList *inBufferList, -00747 const AudioBufferList *outBufferList ); -00748 -00749 private: -00750 -00751 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, -00752 unsigned int firstChannel, unsigned int sampleRate, -00753 RtAudioFormat format, unsigned int *bufferSize, -00754 RtAudio::StreamOptions *options ); -00755 static const char* getErrorCode( OSStatus code ); -00756 }; -00757 -00758 #endif -00759 -00760 #if defined(__UNIX_JACK__) -00761 -00762 class RtApiJack: public RtApi -00763 { -00764 public: -00765 -00766 RtApiJack(); -00767 ~RtApiJack(); -00768 RtAudio::Api getCurrentApi( void ) { return RtAudio::UNIX_JACK; }; -00769 unsigned int getDeviceCount( void ); -00770 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); -00771 void closeStream( void ); -00772 void startStream( void ); -00773 void stopStream( void ); -00774 void abortStream( void ); -00775 long getStreamLatency( void ); -00776 -00777 // This function is intended for internal use only. It must be -00778 // public because it is called by the internal callback handler, -00779 // which is not a member of RtAudio. External use of this function -00780 // will most likely produce highly undesireable results! -00781 bool callbackEvent( unsigned long nframes ); -00782 -00783 private: -00784 -00785 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, -00786 unsigned int firstChannel, unsigned int sampleRate, -00787 RtAudioFormat format, unsigned int *bufferSize, -00788 RtAudio::StreamOptions *options ); -00789 }; -00790 -00791 #endif -00792 -00793 #if defined(__WINDOWS_ASIO__) -00794 -00795 class RtApiAsio: public RtApi -00796 { -00797 public: -00798 -00799 RtApiAsio(); -00800 ~RtApiAsio(); -00801 RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_ASIO; }; -00802 unsigned int getDeviceCount( void ); -00803 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); -00804 void closeStream( void ); -00805 void startStream( void ); -00806 void stopStream( void ); -00807 void abortStream( void ); -00808 long getStreamLatency( void ); -00809 -00810 // This function is intended for internal use only. It must be -00811 // public because it is called by the internal callback handler, -00812 // which is not a member of RtAudio. External use of this function -00813 // will most likely produce highly undesireable results! -00814 bool callbackEvent( long bufferIndex ); -00815 -00816 private: -00817 -00818 std::vector<RtAudio::DeviceInfo> devices_; -00819 void saveDeviceInfo( void ); -00820 bool coInitialized_; -00821 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, -00822 unsigned int firstChannel, unsigned int sampleRate, -00823 RtAudioFormat format, unsigned int *bufferSize, -00824 RtAudio::StreamOptions *options ); -00825 }; -00826 -00827 #endif -00828 -00829 #if defined(__WINDOWS_DS__) -00830 -00831 class RtApiDs: public RtApi -00832 { -00833 public: -00834 -00835 RtApiDs(); -00836 ~RtApiDs(); -00837 RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_DS; }; -00838 unsigned int getDeviceCount( void ); -00839 unsigned int getDefaultOutputDevice( void ); -00840 unsigned int getDefaultInputDevice( void ); -00841 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); -00842 void closeStream( void ); -00843 void startStream( void ); -00844 void stopStream( void ); -00845 void abortStream( void ); -00846 long getStreamLatency( void ); +00741 RtApiCore(); +00742 ~RtApiCore(); +00743 RtAudio::Api getCurrentApi( void ) { return RtAudio::MACOSX_CORE; }; +00744 unsigned int getDeviceCount( void ); +00745 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +00746 unsigned int getDefaultOutputDevice( void ); +00747 unsigned int getDefaultInputDevice( void ); +00748 void closeStream( void ); +00749 void startStream( void ); +00750 void stopStream( void ); +00751 void abortStream( void ); +00752 long getStreamLatency( void ); +00753 +00754 // This function is intended for internal use only. It must be +00755 // public because it is called by the internal callback handler, +00756 // which is not a member of RtAudio. External use of this function +00757 // will most likely produce highly undesireable results! +00758 bool callbackEvent( AudioDeviceID deviceId, +00759 const AudioBufferList *inBufferList, +00760 const AudioBufferList *outBufferList ); +00761 +00762 private: +00763 +00764 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +00765 unsigned int firstChannel, unsigned int sampleRate, +00766 RtAudioFormat format, unsigned int *bufferSize, +00767 RtAudio::StreamOptions *options ); +00768 static const char* getErrorCode( OSStatus code ); +00769 }; +00770 +00771 #endif +00772 +00773 #if defined(__UNIX_JACK__) +00774 +00775 class RtApiJack: public RtApi +00776 { +00777 public: +00778 +00779 RtApiJack(); +00780 ~RtApiJack(); +00781 RtAudio::Api getCurrentApi( void ) { return RtAudio::UNIX_JACK; }; +00782 unsigned int getDeviceCount( void ); +00783 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +00784 void closeStream( void ); +00785 void startStream( void ); +00786 void stopStream( void ); +00787 void abortStream( void ); +00788 long getStreamLatency( void ); +00789 +00790 // This function is intended for internal use only. It must be +00791 // public because it is called by the internal callback handler, +00792 // which is not a member of RtAudio. External use of this function +00793 // will most likely produce highly undesireable results! +00794 bool callbackEvent( unsigned long nframes ); +00795 +00796 private: +00797 +00798 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +00799 unsigned int firstChannel, unsigned int sampleRate, +00800 RtAudioFormat format, unsigned int *bufferSize, +00801 RtAudio::StreamOptions *options ); +00802 }; +00803 +00804 #endif +00805 +00806 #if defined(__WINDOWS_ASIO__) +00807 +00808 class RtApiAsio: public RtApi +00809 { +00810 public: +00811 +00812 RtApiAsio(); +00813 ~RtApiAsio(); +00814 RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_ASIO; }; +00815 unsigned int getDeviceCount( void ); +00816 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +00817 void closeStream( void ); +00818 void startStream( void ); +00819 void stopStream( void ); +00820 void abortStream( void ); +00821 long getStreamLatency( void ); +00822 +00823 // This function is intended for internal use only. It must be +00824 // public because it is called by the internal callback handler, +00825 // which is not a member of RtAudio. External use of this function +00826 // will most likely produce highly undesireable results! +00827 bool callbackEvent( long bufferIndex ); +00828 +00829 private: +00830 +00831 std::vector<RtAudio::DeviceInfo> devices_; +00832 void saveDeviceInfo( void ); +00833 bool coInitialized_; +00834 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +00835 unsigned int firstChannel, unsigned int sampleRate, +00836 RtAudioFormat format, unsigned int *bufferSize, +00837 RtAudio::StreamOptions *options ); +00838 }; +00839 +00840 #endif +00841 +00842 #if defined(__WINDOWS_DS__) +00843 +00844 class RtApiDs: public RtApi +00845 { +00846 public: 00847 -00848 // This function is intended for internal use only. It must be -00849 // public because it is called by the internal callback handler, -00850 // which is not a member of RtAudio. External use of this function -00851 // will most likely produce highly undesireable results! -00852 void callbackEvent( void ); -00853 -00854 private: -00855 -00856 bool coInitialized_; -00857 bool buffersRolling; -00858 long duplexPrerollBytes; -00859 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, -00860 unsigned int firstChannel, unsigned int sampleRate, -00861 RtAudioFormat format, unsigned int *bufferSize, -00862 RtAudio::StreamOptions *options ); -00863 }; -00864 -00865 #endif -00866 -00867 #if defined(__LINUX_ALSA__) -00868 -00869 class RtApiAlsa: public RtApi -00870 { -00871 public: -00872 -00873 RtApiAlsa(); -00874 ~RtApiAlsa(); -00875 RtAudio::Api getCurrentApi() { return RtAudio::LINUX_ALSA; }; -00876 unsigned int getDeviceCount( void ); -00877 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); -00878 void closeStream( void ); -00879 void startStream( void ); -00880 void stopStream( void ); -00881 void abortStream( void ); -00882 -00883 // This function is intended for internal use only. It must be -00884 // public because it is called by the internal callback handler, -00885 // which is not a member of RtAudio. External use of this function -00886 // will most likely produce highly undesireable results! -00887 void callbackEvent( void ); -00888 -00889 private: -00890 -00891 std::vector<RtAudio::DeviceInfo> devices_; -00892 void saveDeviceInfo( void ); -00893 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, -00894 unsigned int firstChannel, unsigned int sampleRate, -00895 RtAudioFormat format, unsigned int *bufferSize, -00896 RtAudio::StreamOptions *options ); -00897 }; -00898 -00899 #endif -00900 -00901 #if defined(__LINUX_OSS__) -00902 -00903 class RtApiOss: public RtApi -00904 { -00905 public: -00906 -00907 RtApiOss(); -00908 ~RtApiOss(); -00909 RtAudio::Api getCurrentApi() { return RtAudio::LINUX_OSS; }; -00910 unsigned int getDeviceCount( void ); -00911 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); -00912 void closeStream( void ); -00913 void startStream( void ); -00914 void stopStream( void ); -00915 void abortStream( void ); -00916 -00917 // This function is intended for internal use only. It must be -00918 // public because it is called by the internal callback handler, -00919 // which is not a member of RtAudio. External use of this function -00920 // will most likely produce highly undesireable results! -00921 void callbackEvent( void ); -00922 -00923 private: -00924 -00925 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, -00926 unsigned int firstChannel, unsigned int sampleRate, -00927 RtAudioFormat format, unsigned int *bufferSize, -00928 RtAudio::StreamOptions *options ); -00929 }; -00930 -00931 #endif -00932 -00933 #if defined(__RTAUDIO_DUMMY__) -00934 -00935 class RtApiDummy: public RtApi -00936 { -00937 public: -00938 -00939 RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( RtError::WARNING ); }; -00940 RtAudio::Api getCurrentApi( void ) { return RtAudio::RTAUDIO_DUMMY; }; -00941 unsigned int getDeviceCount( void ) { return 0; }; -00942 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) { RtAudio::DeviceInfo info; return info; }; -00943 void closeStream( void ) {}; -00944 void startStream( void ) {}; -00945 void stopStream( void ) {}; -00946 void abortStream( void ) {}; -00947 -00948 private: -00949 -00950 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, -00951 unsigned int firstChannel, unsigned int sampleRate, -00952 RtAudioFormat format, unsigned int *bufferSize, -00953 RtAudio::StreamOptions *options ) { return false; }; -00954 }; -00955 -00956 #endif -00957 -00958 #endif -00959 -00960 // Indentation settings for Vim and Emacs -00961 // -00962 // Local Variables: -00963 // c-basic-offset: 2 -00964 // indent-tabs-mode: nil -00965 // End: -00966 // -00967 // vim: et sts=2 sw=2 +00848 RtApiDs(); +00849 ~RtApiDs(); +00850 RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_DS; }; +00851 unsigned int getDeviceCount( void ); +00852 unsigned int getDefaultOutputDevice( void ); +00853 unsigned int getDefaultInputDevice( void ); +00854 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +00855 void closeStream( void ); +00856 void startStream( void ); +00857 void stopStream( void ); +00858 void abortStream( void ); +00859 long getStreamLatency( void ); +00860 +00861 // This function is intended for internal use only. It must be +00862 // public because it is called by the internal callback handler, +00863 // which is not a member of RtAudio. External use of this function +00864 // will most likely produce highly undesireable results! +00865 void callbackEvent( void ); +00866 +00867 private: +00868 +00869 bool coInitialized_; +00870 bool buffersRolling; +00871 long duplexPrerollBytes; +00872 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +00873 unsigned int firstChannel, unsigned int sampleRate, +00874 RtAudioFormat format, unsigned int *bufferSize, +00875 RtAudio::StreamOptions *options ); +00876 }; +00877 +00878 #endif +00879 +00880 #if defined(__LINUX_ALSA__) +00881 +00882 class RtApiAlsa: public RtApi +00883 { +00884 public: +00885 +00886 RtApiAlsa(); +00887 ~RtApiAlsa(); +00888 RtAudio::Api getCurrentApi() { return RtAudio::LINUX_ALSA; }; +00889 unsigned int getDeviceCount( void ); +00890 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +00891 void closeStream( void ); +00892 void startStream( void ); +00893 void stopStream( void ); +00894 void abortStream( void ); +00895 +00896 // This function is intended for internal use only. It must be +00897 // public because it is called by the internal callback handler, +00898 // which is not a member of RtAudio. External use of this function +00899 // will most likely produce highly undesireable results! +00900 void callbackEvent( void ); +00901 +00902 private: +00903 +00904 std::vector<RtAudio::DeviceInfo> devices_; +00905 void saveDeviceInfo( void ); +00906 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +00907 unsigned int firstChannel, unsigned int sampleRate, +00908 RtAudioFormat format, unsigned int *bufferSize, +00909 RtAudio::StreamOptions *options ); +00910 }; +00911 +00912 #endif +00913 +00914 #if defined(__LINUX_OSS__) +00915 +00916 class RtApiOss: public RtApi +00917 { +00918 public: +00919 +00920 RtApiOss(); +00921 ~RtApiOss(); +00922 RtAudio::Api getCurrentApi() { return RtAudio::LINUX_OSS; }; +00923 unsigned int getDeviceCount( void ); +00924 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ); +00925 void closeStream( void ); +00926 void startStream( void ); +00927 void stopStream( void ); +00928 void abortStream( void ); +00929 +00930 // This function is intended for internal use only. It must be +00931 // public because it is called by the internal callback handler, +00932 // which is not a member of RtAudio. External use of this function +00933 // will most likely produce highly undesireable results! +00934 void callbackEvent( void ); +00935 +00936 private: +00937 +00938 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +00939 unsigned int firstChannel, unsigned int sampleRate, +00940 RtAudioFormat format, unsigned int *bufferSize, +00941 RtAudio::StreamOptions *options ); +00942 }; +00943 +00944 #endif +00945 +00946 #if defined(__RTAUDIO_DUMMY__) +00947 +00948 class RtApiDummy: public RtApi +00949 { +00950 public: +00951 +00952 RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( RtError::WARNING ); }; +00953 RtAudio::Api getCurrentApi( void ) { return RtAudio::RTAUDIO_DUMMY; }; +00954 unsigned int getDeviceCount( void ) { return 0; }; +00955 RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) { RtAudio::DeviceInfo info; return info; }; +00956 void closeStream( void ) {}; +00957 void startStream( void ) {}; +00958 void stopStream( void ) {}; +00959 void abortStream( void ) {}; +00960 +00961 private: +00962 +00963 bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, +00964 unsigned int firstChannel, unsigned int sampleRate, +00965 RtAudioFormat format, unsigned int *bufferSize, +00966 RtAudio::StreamOptions *options ) { return false; }; +00967 }; +00968 +00969 #endif +00970 +00971 #endif +00972 +00973 // Indentation settings for Vim and Emacs +00974 // +00975 // Local Variables: +00976 // c-basic-offset: 2 +00977 // indent-tabs-mode: nil +00978 // End: +00979 // +00980 // vim: et sts=2 sw=2
Ed Wildgoose (Linux ALSA and Jack)
+ +The RtAudio API incorporates many of the concepts developed in the PortAudio project by Phil Burk and Ross Bencina. Early development also incorporated ideas from Bill Schottstaedt's sndlib. The CCRMA SoundWire group provided valuable feedback during the API proposal stages.
The early 2.0 version of RtAudio was slowly developed over the course of many months while in residence at the Institut Universitari de L'Audiovisual (IUA) in Barcelona, Spain and the Laboratory of Acoustics and Audio Signal Processing at the Helsinki University of Technology, Finland. Much subsequent development happened while working at the Center for Computer Research in Music and Acoustics (CCRMA) at Stanford University. All recent versions of RtAudio have been completed while working as an assistant / associate professor of Music Technology at McGill University. This work was supported in part by the United States Air Force Office of Scientific Research (grant #F49620-99-1-0293).
diff --git a/doc/html/bugs.html b/doc/html/bugs.html index 686bc7a..fd17ccb 100644 --- a/doc/html/bugs.html +++ b/doc/html/bugs.html @@ -12,7 +12,7 @@# | Version | API | Description | Status |
1 | 4.0.7 | Windows ASIO using gcc4.4 (MinGW) | Functions to set and query supported sample rates fail |
# | Version | API | Description |
1 | 4.0 | Windows DS | Memory allocation bug in device querying |
2 | 4.0 | All unices | Default pthread scheduling priority changed to SCHED_RR when defined |
3 | 4.0 | ALSA | Changed sample rate setting to use snd_pcm_hw_params_set_rate_near() function |
4 | 4.0 | CoreAudio | RtAudio checks a device's internal data format and sets it to the highest allowable bit rate. For some stupid devices, like the Griffin iMic, the default format is 8-bit mono when the requested format and number of channels does not exist. So, we need to query the device's capabilities using the kAudioStreamPropertyPhysicalFormats selector - i.e. ask a device for all of the channels/format/rate combination that it supports - and then enumerate through them to pick the best one. |
5 | 4.0.1 | All | Fix to RtError::WARNING typo in RtAudio.cpp |
6 | 4.0.2 | All | Fix to RtError::WARNING typo in RtAudio.h (RtApiDummy) |
7 | 4.0.4 | Jack | Jack in/out port flag fix |
8 | 4.0.4 | ALSA/OSS | Memory leak fixes in ALSA and OSS |
9 | 4.0.4 | All | Fixed RtAudio::DeviceInfo description in "probing" documentation |
10 | 4.0.4 | All | Fixed clearing of error message stream in error() |
11 | 4.0.4 | All | Fixes in configure script |
12 | 4.0.5 | All | Fix to the way the stream state is changed to avoid infinite loop problem |
13 | 4.0.5 | All | Fix to int<->float conversion in convertBuffer() (thanks to Theo Veenker) |
14 | 4.0.5 | All | Bug fix in byteSwapBuffer() (thanks to Stefan Muller Arisona and Theo Veenker) |
15 | 4.0.5 | OS-X | Fixed a few gcc 4.4 errors in OS-X |
16 | 4.0.5 | All | Fixed bug in rtaudio-config script |
17 | 4.0.5 | ALSA | 64-bit fixes in ALSA API (thanks to Stefan Muller Arisona) |
18 | 4.0.5 | ASIO | Fixed ASIO sample rate selection bug (thanks to Sasha Zheligovsky) |
19 | 4.0.6 | ALSA | Fixed ALSA code to set period size to power of two (thanks to Joakim Karrstrom) |
24 | 4.0.8 | All | Various updates to most APIs to improve stopping efficiency and avoid lockup issues |
23 | 4.0.8 | All | New python binding in "contrib" directory (beta, thanks to Antoine Lefebvre) |
22 | 4.0.8 | OS-X | Fixed problem handling device names in some languages (CFString conversion, Vincent Bénony) |
21 | 4.0.8 | ASIO | Fixed problem using gcc4.4 (MinGW) to set and query supported sample rates |
20 | 4.0.6 | OS-X | Fixed OS-X for OS < 10.5 ... need preprocessor definition around new variable type (thanks to Tristan Matthews) |
19 | 4.0.6 | ALSA | Fixed ALSA code to set period size to power of two (thanks to Joakim Karrstrom) |
18 | 4.0.5 | ASIO | Fixed ASIO sample rate selection bug (thanks to Sasha Zheligovsky) |
17 | 4.0.5 | ALSA | 64-bit fixes in ALSA API (thanks to Stefan Muller Arisona) |
16 | 4.0.5 | All | Fixed bug in rtaudio-config script |
15 | 4.0.5 | OS-X | Fixed a few gcc 4.4 errors in OS-X |
14 | 4.0.5 | All | Bug fix in byteSwapBuffer() (thanks to Stefan Muller Arisona and Theo Veenker) |
13 | 4.0.5 | All | Fix to int<->float conversion in convertBuffer() (thanks to Theo Veenker) |
12 | 4.0.5 | All | Fix to the way the stream state is changed to avoid infinite loop problem |
11 | 4.0.4 | All | Fixes in configure script |
10 | 4.0.4 | All | Fixed clearing of error message stream in error() |
9 | 4.0.4 | All | Fixed RtAudio::DeviceInfo description in "probing" documentation |
8 | 4.0.4 | ALSA/OSS | Memory leak fixes in ALSA and OSS |
7 | 4.0.4 | Jack | Jack in/out port flag fix |
6 | 4.0.2 | All | Fix to RtError::WARNING typo in RtAudio.h (RtApiDummy) |
5 | 4.0.1 | All | Fix to RtError::WARNING typo in RtAudio.cpp |
4 | 4.0 | CoreAudio | RtAudio checks a device's internal data format and sets it to the highest allowable bit rate. For some stupid devices, like the Griffin iMic, the default format is 8-bit mono when the requested format and number of channels does not exist. So, we need to query the device's capabilities using the kAudioStreamPropertyPhysicalFormats selector - i.e. ask a device for all of the channels/format/rate combination that it supports - and then enumerate through them to pick the best one. |
3 | 4.0 | ALSA | Changed sample rate setting to use snd_pcm_hw_params_set_rate_near() function |
2 | 4.0 | All unices | Default pthread scheduling priority changed to SCHED_RR when defined |
1 | 4.0 | Windows DS | Memory allocation bug in device querying |
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
-RtAudio: realtime audio i/o C++ classes Copyright (c) 2001-2010 Gary P. Scavone
+RtAudio: realtime audio i/o C++ classes Copyright (c) 2001-2011 Gary P. Scavone
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Any person wishing to distribute modifications to the Software is asked to send the modifications to the original developer so that they can be incorporated into the canonical version. This is, however, not a binding provision of this license.
diff --git a/doc/html/classRtError-members.html b/doc/html/classRtError-members.html index a1604e8..70bf786 100644 --- a/doc/html/classRtError-members.html +++ b/doc/html/classRtError-members.html @@ -13,14 +13,14 @@DEBUG_WARNING enum value | RtError | |
DRIVER_ERROR enum value | RtError | |
getMessage(void) | RtError | [inline, virtual] |
getType(void) | RtError | [inline, virtual] |
getMessage(void) const | RtError | [inline, virtual] |
getType(void) const | RtError | [inline, virtual] |
INVALID_DEVICE enum value | RtError | |
INVALID_PARAMETER enum value | RtError | |
INVALID_USE enum value | RtError | |
MEMORY_ERROR enum value | RtError | |
NO_DEVICES_FOUND enum value | RtError | |
printMessage(void) | RtError | [inline, virtual] |
printMessage(void) const | RtError | [inline, virtual] |
RtError(const std::string &message, Type type=RtError::UNSPECIFIED) | RtError | [inline] |
SYSTEM_ERROR enum value | RtError | |
THREAD_ERROR enum value | RtError | |
virtual | ~RtError (void) throw () | |
The destructor. | ||
-virtual void | printMessage (void) throw () | |
+virtual void | printMessage (void) const throw () | |
Prints thrown error message to stderr. | ||
-virtual const Type & | getType (void) throw () | |
+virtual const Type & | getType (void) const throw () | |
Returns the thrown error message type. | ||
-virtual const std::string & | getMessage (void) throw () | |
+virtual const std::string & | getMessage (void) const throw () | |
Returns the thrown error message string. | ||
virtual const char * | what (void) const throw () |
A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE).
+A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE, RTAUDIO_ALSA_USE_DEFAULT).