PortAudio 2.0
pa_jack.c File Reference
#include <string.h>
#include <regex.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <sys/types.h>
#include <errno.h>
#include <signal.h>
#include <math.h>
#include <pthread.h>
#include <semaphore.h>
#include <jack/types.h>
#include <jack/jack.h>
#include "pa_util.h"
#include "pa_pthread_util.h"
#include "pa_hostapi.h"
#include "pa_stream.h"
#include "pa_process.h"
#include "pa_allocation.h"
#include "pa_cpuload.h"
#include "pa_ringbuffer.h"
#include "pa_debugprint.h"
#include "pa_jack.h"

Data Structures

struct  PaJackHostApiRepresentation
 
struct  PaJackStream
 

Macros

#define ENSURE_PA(expr)
 
#define UNLESS(expr, code)
 
#define ASSERT_CALL(expr, success)
 
#define JACK_PORT_TYPE_FILTER   "audio"
 
#define TRUE   1
 
#define FALSE   0
 
#define ABS(x)
 
#define ABS(x)
 

Typedefs

typedef struct PaJackStream PaJackStream
 

Functions

PaError PaJack_Initialize (PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex)
 
PaError PaJack_SetClientName (const char *name)
 
PaError PaJack_GetClientName (const char **clientName)
 

Macro Definition Documentation

◆ ABS [1/2]

#define ABS ( x)
Value:
( (x) > 0 ? (x) : -(x) )

◆ ABS [2/2]

#define ABS ( x)
Value:
( (x) > 0 ? (x) : -(x) )

◆ ASSERT_CALL

#define ASSERT_CALL ( expr,
success )
Value:
do { \
int err = (expr); \
assert( err == success ); \
} while( 0 )

Referenced by PaJack_Initialize().

◆ ENSURE_PA

#define ENSURE_PA ( expr)
Value:
do { \
PaError paErr; \
if( (paErr = (expr)) < paNoError ) \
{ \
if( (paErr) == paUnanticipatedHostError && pthread_equal( pthread_self(), mainThread_ ) ) \
{ \
const char *err = jackErr_; \
if (! err ) err = "unknown error"; \
PaUtil_SetLastHostErrorInfo( paJACK, -1, err ); \
} \
PaUtil_DebugPrint(( "Expression '" #expr "' failed in '" __FILE__ "', line: " PA_STRINGIZE( __LINE__ ) "\n" )); \
result = paErr; \
goto error; \
} \
} while( 0 )
#define PA_STRINGIZE(x)
Definition pa_util.h:58
@ paUnanticipatedHostError
Definition portaudio.h:128
@ paNoError
Definition portaudio.h:125
int PaError
Definition portaudio.h:122
@ paJACK
Definition portaudio.h:290

Referenced by PaJack_GetClientName(), and PaJack_Initialize().

◆ FALSE

◆ JACK_PORT_TYPE_FILTER

#define JACK_PORT_TYPE_FILTER   "audio"

◆ TRUE

◆ UNLESS

#define UNLESS ( expr,
code )
Value:
do { \
if( (expr) == 0 ) \
{ \
if( (code) == paUnanticipatedHostError && pthread_equal( pthread_self(), mainThread_ ) ) \
{ \
const char *err = jackErr_; \
if (!err) err = "unknown error"; \
PaUtil_SetLastHostErrorInfo( paJACK, -1, err ); \
} \
PaUtil_DebugPrint(( "Expression '" #expr "' failed in '" __FILE__ "', line: " PA_STRINGIZE( __LINE__ ) "\n" )); \
result = (code); \
goto error; \
} \
} while( 0 )

Referenced by PaJack_Initialize().

Typedef Documentation

◆ PaJackStream

typedef struct PaJackStream PaJackStream

Function Documentation

◆ PaJack_GetClientName()

PaError PaJack_GetClientName ( const char ** clientName)

Get the JACK client name used by PA JACK.

The caller is responsible for freeing the returned pointer.

References ENSURE_PA, PaJackHostApiRepresentation::jack_client, paJACK, paNoError, and PaUtil_GetHostApiRepresentation().

◆ PaJack_Initialize()

◆ PaJack_SetClientName()

PaError PaJack_SetClientName ( const char * name)

Set the JACK client name.

During Pa_Initialize, When PA JACK connects as a client of the JACK server, it requests a certain name, which is for instance prepended to port names. By default this name is "PortAudio". The JACK server may append a suffix to the client name, in order to avoid clashes among clients that try to connect with the same name (e.g., different PA JACK clients).

This function must be called before Pa_Initialize, otherwise it won't have any effect. Note that the string is not copied, but instead referenced directly, so it must not be freed for as long as PA might need it.

See also
PaJack_GetClientName

References paInvalidFlag, and paNoError.