Browse Source

a JACK-specific flag to disable automatic connection of ports

tags/5.0.0
JP Cimalando 8 years ago
parent
commit
6318b51661
2 changed files with 12 additions and 3 deletions
  1. +5
    -3
      RtAudio.cpp
  2. +7
    -0
      RtAudio.h

+ 5
- 3
RtAudio.cpp View File

@@ -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) {


+ 7
- 0
RtAudio.h View File

@@ -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.
@@ -912,6 +917,8 @@ public:
unsigned int firstChannel, unsigned int sampleRate,
RtAudioFormat format, unsigned int *bufferSize,
RtAudio::StreamOptions *options );

bool shouldAutoconnect_;
};

#endif


Loading…
Cancel
Save