Setting Client Callbacks Detailed DescriptionJACK allows to register numerous callback functions for various purposes. The most important ones are listed in this group. Note that there are however also other callbacks on other JACK API parts. The most important callback, which usually every JACK client application implements, is registered with jack_set_process_callback(). With the latter your application provides a function that is periodically called to process audio & MIDI.
Function Documentation
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. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
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 in case 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. NOTE: application should typically signal another thread to correctly finish cleanup, that is by calling "jack_client_close" (since "jack_client_close" cannot be called directly in the context of the thread that calls the shutdown callback).
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 case of a client thread shutdown, the callback passed to jack_on_info_shutdown() will be called. NOTE: application should typically signal another thread to correctly finish cleanup, that is by calling "jack_client_close" (since "jack_client_close" cannot be called directly in the context of the thread that calls the shutdown callback).
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. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
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. All "notification events" are received in a seperated non RT thread, the code in the supplied function does not need to be suitable for real-time execution. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
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. All "notification events" are received in a seperated non RT thread, the code in the supplied function does not need to be suitable for real-time execution. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
Tell the Jack server to call srate_callback whenever the system sample rate changes. All "notification events" are received in a seperated non RT thread, the code in the supplied function does not need to be suitable for real-time execution. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
Tell the JACK server to call client_registration_callback whenever a client is registered or unregistered, passing arg as a parameter. All "notification events" are received in a seperated non RT thread, the code in the supplied function does not need to be suitable for real-time execution. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
Tell the JACK server to call registration_callback whenever a port is registered or unregistered, passing arg as a parameter. All "notification events" are received in a seperated non RT thread, the code in the supplied function does not need to be suitable for real-time execution. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
Tell the JACK server to call connect_callback whenever a port is connected or disconnected, passing arg as a parameter. All "notification events" are received in a seperated non RT thread, the code in the supplied function does not need to be suitable for real-time execution. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
Tell the JACK server to call rename_callback whenever a port is renamed, passing arg as a parameter. All "notification events" are received in a seperated non RT thread, the code in the supplied function does not need to be suitable for real-time execution. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
Tell the JACK server to call graph_callback whenever the processing graph is reordered, passing arg as a parameter. All "notification events" are received in a seperated non RT thread, the code in the supplied function does not need to be suitable for real-time execution. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
Tell the JACK server to call xrun_callback whenever there is a xrun, passing arg as a parameter. All "notification events" are received in a seperated non RT thread, the code in the supplied function does not need to be suitable for real-time execution. NOTE: this function cannot be called while the client is activated (after jack_activate has been called.)
Generated by |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|