#include <cstdlib>\r
#include <cstring>\r
#include <climits>\r
+#include <cmath>\r
#include <algorithm>\r
\r
// Static variable definitions.\r
//\r
// *************************************************** //\r
\r
-std::string RtAudio :: getVersion( void ) throw()\r
+std::string RtAudio :: getVersion( void )\r
{\r
return RTAUDIO_VERSION;\r
}\r
\r
-void RtAudio :: getCompiledApi( std::vector<RtAudio::Api> &apis ) throw()\r
+void RtAudio :: getCompiledApi( std::vector<RtAudio::Api> &apis )\r
{\r
apis.clear();\r
\r
throw( RtAudioError( errorText, RtAudioError::UNSPECIFIED ) );\r
}\r
\r
-RtAudio :: ~RtAudio() throw()\r
+RtAudio :: ~RtAudio()\r
{\r
if ( rtapi_ )\r
delete rtapi_;\r
\r
if ( time >= 0.0 )\r
stream_.streamTime = time;\r
+#if defined( HAVE_GETTIMEOFDAY )\r
+ gettimeofday( &stream_.lastTickTimestamp, NULL );\r
+#endif\r
}\r
\r
unsigned int RtApi :: getStreamSampleRate( void )\r
static void jackSilentError( const char * ) {};\r
\r
RtApiJack :: RtApiJack()\r
-{\r
+ :shouldAutoconnect_(true) {\r
// Nothing to do here.\r
#if !defined(__RTAUDIO_DEBUG__)\r
// Turn off Jack's internal error reporting.\r
// here.\r
if ( stream_.doConvertBuffer[mode] ) setConvertInfo( mode, 0 );\r
\r
+ if ( options && options->flags & RTAUDIO_JACK_DONT_CONNECT ) shouldAutoconnect_ = false;\r
+\r
return SUCCESS;\r
\r
error:\r
const char **ports;\r
\r
// Get the list of available ports.\r
- if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) {\r
+ if ( shouldAutoconnect_ && (stream_.mode == OUTPUT || stream_.mode == DUPLEX) ) {\r
result = 1;\r
ports = jack_get_ports( handle->client, handle->deviceName[0].c_str(), NULL, JackPortIsInput);\r
if ( ports == NULL) {\r
free(ports);\r
}\r
\r
- if ( stream_.mode == INPUT || stream_.mode == DUPLEX ) {\r
+ if ( shouldAutoconnect_ && (stream_.mode == INPUT || stream_.mode == DUPLEX) ) {\r
result = 1;\r
ports = jack_get_ports( handle->client, handle->deviceName[1].c_str(), NULL, JackPortIsOutput );\r
if ( ports == NULL) {\r
float sampleStep = 1.0f / sampleRatio;\r
float inSampleFraction = 0.0f;\r
\r
- outSampleCount = ( unsigned int ) roundf( inSampleCount * sampleRatio );\r
+ outSampleCount = ( unsigned int ) std::roundf( inSampleCount * sampleRatio );\r
\r
// if inSampleRate is a multiple of outSampleRate (or vice versa) there's no need to interpolate\r
if ( floor( sampleRatio ) == sampleRatio || floor( sampleRatioInv ) == sampleRatioInv )\r
// Various revisions for RtAudio 4.0 by Gary Scavone, April 2007\r
// Changed device query structure for RtAudio 4.0.7, January 2010\r
\r
+#include <mmsystem.h>\r
+#include <mmreg.h>\r
#include <dsound.h>\r
#include <assert.h>\r
#include <algorithm>\r
\r
RtApiDs :: ~RtApiDs()\r
{\r
- if ( coInitialized_ ) CoUninitialize(); // balanced call.\r
if ( stream_.state != STREAM_CLOSED ) closeStream();\r
+ if ( coInitialized_ ) CoUninitialize(); // balanced call.\r
}\r
\r
// The DirectSound default output is always the first device.\r
info.nativeFormats |= RTAUDIO_SINT8;\r
if ( mask & AFMT_S32_LE || mask & AFMT_S32_BE )\r
info.nativeFormats |= RTAUDIO_SINT32;\r
+#ifdef AFMT_FLOAT\r
if ( mask & AFMT_FLOAT )\r
info.nativeFormats |= RTAUDIO_FLOAT32;\r
+#endif\r
if ( mask & AFMT_S24_LE || mask & AFMT_S24_BE )\r
info.nativeFormats |= RTAUDIO_SINT24;\r
\r
}\r
\r
// Verify the sample rate setup worked.\r
- if ( abs( srate - sampleRate ) > 100 ) {\r
+ if ( abs( srate - (int)sampleRate ) > 100 ) {\r
close( fd );\r
errorStream_ << "RtApiOss::probeDeviceOpen: device (" << ainfo.name << ") does not support sample rate (" << sampleRate << ").";\r
errorText_ = errorStream_.str();\r