stream_.userBuffer[1] = 0;\r
MUTEX_INITIALIZE( &stream_.mutex );\r
showWarnings_ = true;\r
+ firstErrorOccurred = false;\r
}\r
\r
RtApi :: ~RtApi()\r
}\r
\r
if ( ( stream_.mode == INPUT || stream_.mode == DUPLEX ) && !apiInfo->synchronized ) {\r
+ result = snd_pcm_drop(handle[1]); // fix to remove stale data received since device has been open\r
state = snd_pcm_state( handle[1] );\r
if ( state != SND_PCM_STATE_PREPARED ) {\r
result = snd_pcm_prepare( handle[1] );\r
stream_.state = STREAM_RUNNING;\r
\r
unlock:\r
- apiInfo->runnable = true;\r
+ apiInfo->runnable = false; // fixes high CPU usage when stopped\r
pthread_cond_signal( &apiInfo->runnable_cv );\r
MUTEX_UNLOCK( &stream_.mutex );\r
\r
}\r
\r
unlock:\r
+ apiInfo->runnable = false; // fixes high CPU usage when stopped\r
MUTEX_UNLOCK( &stream_.mutex );\r
\r
if ( result >= 0 ) return;\r
#include <sys/ioctl.h>\r
#include <unistd.h>\r
#include <fcntl.h>\r
-#include "soundcard.h"\r
+#include <sys/soundcard.h>\r
#include <errno.h>\r
#include <math.h>\r
\r
RtAudioErrorCallback errorCallback = (RtAudioErrorCallback) stream_.callbackInfo.errorCallback;\r
if ( errorCallback ) {\r
// abortStream() can generate new error messages. Ignore them. Just keep original one.\r
- static bool firstErrorOccured = false;\r
\r
- if ( firstErrorOccured )\r
+ if ( firstErrorOccurred )\r
return;\r
\r
- firstErrorOccured = true;\r
+ firstErrorOccurred = true;\r
const std::string errorMessage = errorText_;\r
\r
if ( type != RtAudioError::WARNING && stream_.state != STREAM_STOPPED) {\r
}\r
\r
errorCallback( type, errorMessage );\r
- firstErrorOccured = false;\r
+ firstErrorOccurred = false;\r
return;\r
}\r
\r
#include <exception>
#include <iostream>
-// RtAudio version
-static const std::string RTAUDIO_VERSION( "4.1.0pre" );
+// RtAudio version: 4.1.0pre
/*! \typedef typedef unsigned long RtAudioFormat;
\brief RtAudio data format type.
};
//! A static function to determine the current RtAudio version.
- static std::string getVersion( void ) { return RTAUDIO_VERSION; }
+ static std::string getVersion( void ) { return "4.1.0"; }
//! A static function to determine the available compiled audio APIs.
/*!
#include <windows.h>
#include <process.h>
- typedef unsigned long ThreadHandle;
+ typedef ULONG_PTR ThreadHandle;
typedef CRITICAL_SECTION StreamMutex;
#elif defined(__LINUX_ALSA__) || defined(__LINUX_PULSE__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__)
std::string errorText_;
bool showWarnings_;
RtApiStream stream_;
+ bool firstErrorOccurred;
/*!
Protected, api-specific method that attempts to open a device
v4.1.0: (?? 2014)
- RtError class renamed RtAudioError and embedded in RtAudio.h (RtError.h deleted)
+- pulse audio update to support bufferFrames argument with audio input (thanks to Jonatan Wallmander)
+- fixes for ALSA API to avoid high CPU usage during stops and to clear stale data before input (thanks to Pluto Hades)
+- miscellaneous efficiency updates suggested by Martin Koegler
v4.0.12: (16 April 2013)
- new functionality to allow error reporting via a client-supplied function (thanks to Pavel Mogilevskiy)