Functions

Setting Client Callbacks

Functions

int jack_set_thread_init_callback (jack_client_t *client, JackThreadInitCallback thread_init_callback, void *arg)
void jack_on_shutdown (jack_client_t *client, JackShutdownCallback function, void *arg)
void jack_on_info_shutdown (jack_client_t *client, JackInfoShutdownCallback function, void *arg) JACK_WEAK_EXPORT
int jack_set_process_callback (jack_client_t *client, JackProcessCallback process_callback, void *arg)
int jack_set_freewheel_callback (jack_client_t *client, JackFreewheelCallback freewheel_callback, void *arg)
int jack_set_buffer_size_callback (jack_client_t *client, JackBufferSizeCallback bufsize_callback, void *arg)
int jack_set_sample_rate_callback (jack_client_t *client, JackSampleRateCallback srate_callback, void *arg)
int jack_set_client_registration_callback (jack_client_t *, JackClientRegistrationCallback registration_callback, void *arg)
int jack_set_port_registration_callback (jack_client_t *, JackPortRegistrationCallback registration_callback, void *arg)
int jack_set_port_connect_callback (jack_client_t *, JackPortConnectCallback connect_callback, void *arg)
int jack_set_graph_order_callback (jack_client_t *, JackGraphOrderCallback graph_callback, void *)
int jack_set_xrun_callback (jack_client_t *, JackXRunCallback xrun_callback, void *arg)

Function Documentation

void jack_on_info_shutdown ( jack_client_t client,
JackInfoShutdownCallback  function,
void *  arg 
)
Parameters:
clientpointer to JACK client structure.
functionThe jack_shutdown function pointer.
argThe arguments for the jack_shutdown function.

Register a function (and argument) to be called if and when the JACK server shuts down the client thread. The function must be written as if it were an asynchonrous POSIX signal handler --- use only async-safe functions, and remember that it is executed from another thread. A typical function might set a flag or write to a pipe so that the rest of the application knows that the JACK client thread has shut down.

NOTE: clients do not need to call this. It exists only to help more complex clients understand what is going on. It should be called before jack_client_activate().

NOTE: if a client calls this AND jack_on_shutdown(), then in the event of a client thread shutdown, the callback passed to this function will be called, and the one passed to jack_on_shutdown() will not.

void jack_on_shutdown ( jack_client_t client,
JackShutdownCallback  function,
void *  arg 
)
Parameters:
clientpointer to JACK client structure.
functionThe jack_shutdown function pointer.
argThe arguments for the jack_shutdown function.

Register a function (and argument) to be called if and when the JACK server shuts down the client thread. The function must be written as if it were an asynchonrous POSIX signal handler --- use only async-safe functions, and remember that it is executed from another thread. A typical function might set a flag or write to a pipe so that the rest of the application knows that the JACK client thread has shut down.

NOTE: clients do not need to call this. It exists only to help more complex clients understand what is going on. It should be called before jack_client_activate().

NOTE: if a client calls this AND jack_on_info_shutdown(), then the event of a client thread shutdown, the callback passed to this function will not be called, and the one passed to jack_on_info_shutdown() will.

Referenced by main().

int jack_set_buffer_size_callback ( jack_client_t client,
JackBufferSizeCallback  bufsize_callback,
void *  arg 
)

Tell JACK to call bufsize_callback whenever the size of the the buffer that will be passed to the process_callback is about to change. Clients that depend on knowing the buffer size must supply a bufsize_callback before activating themselves.

Parameters:
clientpointer to JACK client structure.
bufsize_callbackfunction to call when the buffer size changes.
argargument for bufsize_callback.
Returns:
0 on success, otherwise a non-zero error code
int jack_set_client_registration_callback ( jack_client_t ,
JackClientRegistrationCallback  registration_callback,
void *  arg 
)

Tell the JACK server to call registration_callback whenever a port is registered or unregistered, passing arg as a parameter.

Returns:
0 on success, otherwise a non-zero error code
int jack_set_freewheel_callback ( jack_client_t client,
JackFreewheelCallback  freewheel_callback,
void *  arg 
)

Tell the Jack server to call freewheel_callback whenever we enter or leave "freewheel" mode, passing arg as the second argument. The first argument to the callback will be non-zero if JACK is entering freewheel mode, and zero otherwise.

Returns:
0 on success, otherwise a non-zero error code.
int jack_set_graph_order_callback ( jack_client_t ,
JackGraphOrderCallback  graph_callback,
void *   
)

Tell the JACK server to call graph_callback whenever the processing graph is reordered, passing arg as a parameter.

Returns:
0 on success, otherwise a non-zero error code
int jack_set_port_connect_callback ( jack_client_t ,
JackPortConnectCallback  connect_callback,
void *  arg 
)

Tell the JACK server to call connect_callback whenever a port is connected or disconnected, passing arg as a parameter.

Returns:
0 on success, otherwise a non-zero error code
int jack_set_port_registration_callback ( jack_client_t ,
JackPortRegistrationCallback  registration_callback,
void *  arg 
)

Tell the JACK server to call registration_callback whenever a port is registered or unregistered, passing arg as a parameter.

Returns:
0 on success, otherwise a non-zero error code
int jack_set_process_callback ( jack_client_t client,
JackProcessCallback  process_callback,
void *  arg 
)

Tell the Jack server to call process_callback whenever there is work be done, passing arg as the second argument.

The code in the supplied function must be suitable for real-time execution. That means that it cannot call functions that might block for a long time. This includes malloc, free, printf, pthread_mutex_lock, sleep, wait, poll, select, pthread_join, pthread_cond_wait, etc, etc.

Returns:
0 on success, otherwise a non-zero error code, causing JACK to remove that client from the process() graph.

Referenced by jack_initialize(), and main().

int jack_set_sample_rate_callback ( jack_client_t client,
JackSampleRateCallback  srate_callback,
void *  arg 
)

Tell the Jack server to call srate_callback whenever the system sample rate changes.

Returns:
0 on success, otherwise a non-zero error code
int jack_set_thread_init_callback ( jack_client_t client,
JackThreadInitCallback  thread_init_callback,
void *  arg 
)

Tell JACK to call thread_init_callback once just after the creation of the thread in which all other callbacks will be handled.

The code in the supplied function does not need to be suitable for real-time execution.

Returns:
0 on success, otherwise a non-zero error code, causing JACK to remove that client from the process() graph.
int jack_set_xrun_callback ( jack_client_t ,
JackXRunCallback  xrun_callback,
void *  arg 
)

Tell the JACK server to call xrun_callback whenever there is a xrun, passing arg as a parameter.

Returns:
0 on success, otherwise a non-zero error code