From 6318b5166166c87ac33842a4c9fcb42d202b5f27 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Tue, 26 Jul 2016 09:58:47 +0200 Subject: a JACK-specific flag to disable automatic connection of ports --- RtAudio.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'RtAudio.cpp') diff --git a/RtAudio.cpp b/RtAudio.cpp index 882fa0e..d41c408 100644 --- a/RtAudio.cpp +++ b/RtAudio.cpp @@ -1943,7 +1943,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 +2354,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 +2445,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 +2469,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) { -- cgit v1.2.3