X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=RtAudio.cpp;h=0b952f02ec8812c169d3eb17d1ca5c94ae151070;hb=7ee88e03ee2164168139db026fd1de62633b63d2;hp=fa365f76f2040f40a79b11fd3e6305750ef634d4;hpb=3125beff6adb36e7d78d413cc0dd308a5edfeb7a;p=rtaudio-cdist.git diff --git a/RtAudio.cpp b/RtAudio.cpp index fa365f7..0b952f0 100644 --- a/RtAudio.cpp +++ b/RtAudio.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include // Static variable definitions. @@ -427,6 +428,9 @@ void RtApi :: setStreamTime( double time ) if ( time >= 0.0 ) stream_.streamTime = time; +#if defined( HAVE_GETTIMEOFDAY ) + gettimeofday( &stream_.lastTickTimestamp, NULL ); +#endif } unsigned int RtApi :: getStreamSampleRate( void ) @@ -1943,7 +1947,7 @@ struct JackHandle { static void jackSilentError( const char * ) {}; RtApiJack :: RtApiJack() -{ + :shouldAutoconnect_(true) { // Nothing to do here. #if !defined(__RTAUDIO_DEBUG__) // Turn off Jack's internal error reporting. @@ -2354,6 +2358,8 @@ bool RtApiJack :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne // here. if ( stream_.doConvertBuffer[mode] ) setConvertInfo( mode, 0 ); + if ( options && options->flags & RTAUDIO_JACK_DONT_CONNECT ) shouldAutoconnect_ = false; + return SUCCESS; error: @@ -2443,7 +2449,7 @@ void RtApiJack :: startStream( void ) const char **ports; // Get the list of available ports. - if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) { + if ( shouldAutoconnect_ && (stream_.mode == OUTPUT || stream_.mode == DUPLEX) ) { result = 1; ports = jack_get_ports( handle->client, handle->deviceName[0].c_str(), NULL, JackPortIsInput); if ( ports == NULL) { @@ -2467,7 +2473,7 @@ void RtApiJack :: startStream( void ) free(ports); } - if ( stream_.mode == INPUT || stream_.mode == DUPLEX ) { + if ( shouldAutoconnect_ && (stream_.mode == INPUT || stream_.mode == DUPLEX) ) { result = 1; ports = jack_get_ports( handle->client, handle->deviceName[1].c_str(), NULL, JackPortIsOutput ); if ( ports == NULL) { @@ -3875,7 +3881,7 @@ void convertBufferWasapi( char* outBuffer, float sampleStep = 1.0f / sampleRatio; float inSampleFraction = 0.0f; - outSampleCount = ( unsigned int ) roundf( inSampleCount * sampleRatio ); + outSampleCount = ( unsigned int ) std::roundf( inSampleCount * sampleRatio ); // if inSampleRate is a multiple of outSampleRate (or vice versa) there's no need to interpolate if ( floor( sampleRatio ) == sampleRatio || floor( sampleRatioInv ) == sampleRatioInv ) @@ -5283,6 +5289,8 @@ Exit: // Various revisions for RtAudio 4.0 by Gary Scavone, April 2007 // Changed device query structure for RtAudio 4.0.7, January 2010 +#include +#include #include #include #include