JackUtils 0.5
Provides simplified Jack API for clients :)
|
Typedefs | |
typedef int(* | ju_save_cb) (ju_ctx_t *ctx, void *ud) |
Save callback, that called each time when user sends save command from session manager, or, in case of no session manager, on SIGTERM and at exiting Jack Audio Processing. More... | |
Functions | |
JU_API ju_ctx_t *() | ju_ctx_init (ju_cstr_t n, ju_cstr_t pn, int has_gui) |
Allocates and Initializes jackutils context structure. More... | |
JU_API void() | ju_ctx_uninit (ju_ctx_t *x) |
Destroy context and release resources. More... | |
JU_API ju_cstr_t() | ju_get_name (ju_ctx_t *x) |
Returns real JACK client name. More... | |
JU_API ju_cstr_t() | ju_jack_info (void) |
Returns information about JACK library. More... | |
JU_API int() | ju_start (ju_ctx_t *x, ju_process_func_t c) |
Starts JACK Audio Processing. More... | |
JU_API void() | ju_stop (ju_ctx_t *x) |
Stops client processing. More... | |
JU_PROC size_t() | ju_length (ju_ctx_t *x) |
This function may be called only after starting Jack Audio Processing! More... | |
JU_API jack_nframes_t() | ju_samplerate (ju_ctx_t *x) |
Returns global JACK samplerate. More... | |
JU_API int() | ju_is_online (ju_ctx_t *x, int t) |
Checks is server online, and are we started Jack Audio Processing ju_start(). More... | |
JU_API int() | ju_need_gui (ju_ctx_t *x) |
Returns is GUI enabled for us. More... | |
JU_API void() | ju_set_gui (ju_ctx_t *x, int b) |
Set ju_need_gui returned value and send it to session manager. More... | |
JU_API ju_cstr_t() | ju_osc_info (ju_ctx_t *ctx) |
Returns information about session manager, if available. More... | |
JU_API ju_cstr_t() | ju_osc_path (ju_ctx_t *ctx) |
Returns OSC path to store your session data. More... | |
JU_API void() | ju_pool_events (ju_ctx_t *ctx) |
Call this in main loop to recieve and process messages from session manager. More... | |
JU_API void() | ju_onsave (ju_ctx_t *ctx, ju_save_cb cb, void *ud) |
Sets custom on_save callback. More... | |
typedef int(* ju_save_cb) (ju_ctx_t *ctx, void *ud) |
Save callback, that called each time when user sends save command from session manager, or, in case of no session manager, on SIGTERM and at exiting Jack Audio Processing.
ctx | JackUtils Context |
ud | userdata |
Allocates and Initializes jackutils context structure.
Connection with the session manager will be establilshed in this function too!
n | client name (may be changed by server) |
pn | filename of current executable (argv[0] value) |
has_gui | has GUI? |
References ju_ctx_s::client, ju_ctx_s::close, CLOSE_PORT_NAME, ju_ctx_s::length, ju_ctx_s::mdata, ju_ctx_s::mutex, ju_ctx_s::osc, ju_ctx_s::samplerate, ju_ctx_s::session_path, and ju_ctx_s::works.
JU_API void() ju_ctx_uninit | ( | ju_ctx_t * | x | ) |
Destroy context and release resources.
x | JackuUtils context |
Returns real JACK client name.
x | JackuUtils context |
JU_API int() ju_is_online | ( | ju_ctx_t * | x, |
int | t | ||
) |
Checks is server online, and are we started Jack Audio Processing ju_start().
UPDATE: since Session manager support was added. If connection with session manager is exists, this function will returns 0 ONLY in case of session manager stops us or JACK server is crashed.
Else if there is no connection with session manager, this function will return 0 only if jack is crashed OR __close port is connected. __close port is NOT created if session manager is available!
x | JackUtils context |
t | timeout in MILLISeconds to wait (-1 forever, 0 - no sleep) |
JU_API ju_cstr_t() ju_jack_info | ( | void | ) |
Returns information about JACK library.
JU_PROC size_t() ju_length | ( | ju_ctx_t * | x | ) |
This function may be called only after starting Jack Audio Processing!
x | context |
JU_API int() ju_need_gui | ( | ju_ctx_t * | x | ) |
Returns is GUI enabled for us.
If this functions returns true, then you SHOULD show your window. Else you SHOULD hide it, and draw nothing.
If there is no session manager, returns true until ju_set_gui is not called.
x | context |
References ju_ctx_s::gui_showed, and ju_ctx_s::mdata.
JU_API void() ju_onsave | ( | ju_ctx_t * | ctx, |
ju_save_cb | cb, | ||
void * | ud | ||
) |
Sets custom on_save callback.
ctx | JackUtils context |
cb | callback |
ud | userdata passed to callback |
Returns information about session manager, if available.
ctx | context |
Returns OSC path to store your session data.
If there is no session manager, returns "~/.local/share/jackutils/"
From NSM Documentation : returns a path name in the form client_name.ID, assigned to the client for storing its project data. The client MUST choose one of the four strategies below to save, so that every file in the session can be traced back to a client and, vice versa, a client name.ID can be used to look up all its files. (For example to clean up the session dir) :
ctx | context |
JU_API void() ju_pool_events | ( | ju_ctx_t * | ctx | ) |
Call this in main loop to recieve and process messages from session manager.
ctx | context |
References ju_ctx_s::osc.
JU_API jack_nframes_t() ju_samplerate | ( | ju_ctx_t * | x | ) |
Returns global JACK samplerate.
It does not changes during JACK server lifetime.
x | context |
JU_API void() ju_set_gui | ( | ju_ctx_t * | x, |
int | b | ||
) |
Set ju_need_gui returned value and send it to session manager.
If there is no session manager, setting this to 0 makes ju_is_online return 0 too! (=> closes your program)
x | context |
b | show gui |
References ju_stop().
JU_API int() ju_start | ( | ju_ctx_t * | x, |
ju_process_func_t | c | ||
) |
Starts JACK Audio Processing.
Do this after context and port creation. ju_process_func_t will be called in another thread each time when audio data needs to be processed
This process callback should not call functions that might block for long time, like malloc(), free(), pthread_join(), sleep(), wait() and etc. => process callback should work as fast as possible!
x | JackUtils context |
c | process callack |
JU_API void() ju_stop | ( | ju_ctx_t * | x | ) |