Jack: Add a port-type filter expression to calls to jack_get_ports() so that only audio ports are listed (removing eg Midi etc) as reported by 'sqweek'.
This commit is contained in:
parent
e2662ae2ad
commit
e62b586273
1 changed files with 9 additions and 5 deletions
|
|
@ -232,6 +232,10 @@ typedef struct PaJackStream
|
|||
}
|
||||
PaJackStream;
|
||||
|
||||
/* In calls to jack_get_ports() this filter expression is used instead of ""
|
||||
* to prevent any other types (eg Midi ports etc) being listed */
|
||||
#define JACK_PORT_TYPE_FILTER "audio"
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
|
|
@ -492,7 +496,7 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
|
|||
* according to the client_name:port_name convention (which is
|
||||
* enforced by jackd)
|
||||
* A: If jack_get_ports returns NULL, there's nothing for us to do */
|
||||
UNLESS( (jack_ports = jack_get_ports( jackApi->jack_client, "", "", 0 )) && jack_ports[0], paNoError );
|
||||
UNLESS( (jack_ports = jack_get_ports( jackApi->jack_client, "", JACK_PORT_TYPE_FILTER, 0 )) && jack_ports[0], paNoError );
|
||||
/* Find number of ports */
|
||||
while( jack_ports[numPorts] )
|
||||
++numPorts;
|
||||
|
|
@ -583,7 +587,7 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
|
|||
|
||||
/* ... what are your output ports (that we could input from)? */
|
||||
clientPorts = jack_get_ports( jackApi->jack_client, regex_pattern,
|
||||
NULL, JackPortIsOutput);
|
||||
JACK_PORT_TYPE_FILTER, JackPortIsOutput);
|
||||
curDevInfo->maxInputChannels = 0;
|
||||
curDevInfo->defaultLowInputLatency = 0.;
|
||||
curDevInfo->defaultHighInputLatency = 0.;
|
||||
|
|
@ -604,7 +608,7 @@ static PaError BuildDeviceList( PaJackHostApiRepresentation *jackApi )
|
|||
|
||||
/* ... what are your input ports (that we could output to)? */
|
||||
clientPorts = jack_get_ports( jackApi->jack_client, regex_pattern,
|
||||
NULL, JackPortIsInput);
|
||||
JACK_PORT_TYPE_FILTER, JackPortIsInput);
|
||||
curDevInfo->maxOutputChannels = 0;
|
||||
curDevInfo->defaultLowOutputLatency = 0.;
|
||||
curDevInfo->defaultHighOutputLatency = 0.;
|
||||
|
|
@ -1235,7 +1239,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
|||
/* Get output ports of our capture device */
|
||||
snprintf( regex_pattern, regexSz, "%s:.*", hostApi->deviceInfos[ inputParameters->device ]->name );
|
||||
UNLESS( jack_ports = jack_get_ports( jackHostApi->jack_client, regex_pattern,
|
||||
NULL, JackPortIsOutput ), paUnanticipatedHostError );
|
||||
JACK_PORT_TYPE_FILTER, JackPortIsOutput ), paUnanticipatedHostError );
|
||||
for( i = 0; i < inputChannelCount && jack_ports[i]; i++ )
|
||||
{
|
||||
if( (stream->remote_output_ports[i] = jack_port_by_name(
|
||||
|
|
@ -1259,7 +1263,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
|||
/* Get input ports of our playback device */
|
||||
snprintf( regex_pattern, regexSz, "%s:.*", hostApi->deviceInfos[ outputParameters->device ]->name );
|
||||
UNLESS( jack_ports = jack_get_ports( jackHostApi->jack_client, regex_pattern,
|
||||
NULL, JackPortIsInput ), paUnanticipatedHostError );
|
||||
JACK_PORT_TYPE_FILTER, JackPortIsInput ), paUnanticipatedHostError );
|
||||
for( i = 0; i < outputChannelCount && jack_ports[i]; i++ )
|
||||
{
|
||||
if( (stream->remote_input_ports[i] = jack_port_by_name(
|
||||
|
|
|
|||
Loading…
Reference in a new issue