diff options
| author | garyscavone <garyscavone@users.noreply.github.com> | 2017-08-24 13:34:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-24 13:34:04 -0700 |
| commit | 4ee8b95d791a54aca593ad24d4eabbaac90355c0 (patch) | |
| tree | 1b6d4c8457ea4f7bc929512d1dbf58e281ebafb0 | |
| parent | 89d9757f80b5abb10da88300c1217b062fe5925b (diff) | |
| parent | 6318b5166166c87ac33842a4c9fcb42d202b5f27 (diff) | |
Merge pull request #68 from jpcima/master
a JACK-specific flag to disable automatic connection of ports
| -rw-r--r-- | RtAudio.cpp | 8 | ||||
| -rw-r--r-- | RtAudio.h | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp index 61b4708..0b952f0 100644 --- a/RtAudio.cpp +++ b/RtAudio.cpp @@ -1947,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.
@@ -2358,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:
@@ -2447,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) {
@@ -2471,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) {
@@ -86,6 +86,7 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi - \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency. - \e RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use. - \e RTAUDIO_ALSA_USE_DEFAULT: Use the "default" PCM device (ALSA only). + - \e RTAUDIO_JACK_DONT_CONNECT: Do not automatically connect ports (JACK only). By default, RtAudio streams pass and receive audio data from the client in an interleaved format. By passing the @@ -117,6 +118,9 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi 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. + + If the RTAUDIO_JACK_DONT_CONNECT flag is set, RtAudio will not attempt + to automatically connect the ports of the client to the audio device. */ typedef unsigned int RtAudioStreamFlags; static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1; // Use non-interleaved buffers (default = interleaved). @@ -124,6 +128,7 @@ static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2; // Attempt to s static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4; // Attempt grab device and prevent use by others. static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8; // Try to select realtime scheduling for callback thread. static const RtAudioStreamFlags RTAUDIO_ALSA_USE_DEFAULT = 0x10; // Use the "default" PCM device (ALSA only). +static const RtAudioStreamFlags RTAUDIO_JACK_DONT_CONNECT = 0x20; // Do not automatically connect ports (JACK only). /*! \typedef typedef unsigned long RtAudioStreamStatus; \brief RtAudio stream status (over- or underflow) flags. @@ -909,6 +914,8 @@ public: unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options ); + + bool shouldAutoconnect_; }; #endif |
