JackUtils 0.5
Provides simplified Jack API for clients :)
|
Functions | |
JU_API int | ju_port_open (ju_ctx_t *x, ju_cstr_t n, enum ju_port_type t, int f) |
Creates new port, and returns port desriptor. More... | |
JU_API void | ju_port_close (ju_ctx_t *x, int p) |
Decreases reference counter of port, and destroys it, if refcounter == 0. More... | |
JU_API void | ju_port_take (ju_ctx_t *x, int p) |
Increases reference counter of port. More... | |
JU_API int | ju_port_connected (ju_ctx_t *x, int p) |
Returns number of connections to the port (or simply is port connected to anything) More... | |
JU_API int | ju_port_mine (ju_ctx_t *x, int p) |
Returns is port owned by context. More... | |
JU_API int | ju_port_next (ju_ctx_t *x, int p, enum ju_port_type t) |
Returns next valid port descriptor, owned by JackUtils context. More... | |
JU_API int | ju_port_find (ju_ctx_t *x, ju_cstr_t n) |
Finds port by full name. More... | |
JU_PROC const ju_sample_t *() | ju_port_read (ju_ctx_t *x, int p) |
Gets audio buffer from the port. More... | |
JU_PROC size_t() | ju_port_write (ju_ctx_t *x, int p, const ju_sample_t *a, size_t l) |
Writes data to port with Output type from sample array. More... | |
JU_PROC void() | ju_port_write_stream (ju_ctx_t *x, int p, ju_stream_func_t s, void *u) |
Writes data to port with Output type from stream callback. More... | |
JU_API int | ju_port_rawfind (ju_ctx_t *x, jack_port_t *p, int not_own) |
Finds existed port handle, or takes new port handle from jack_port_t. More... | |
JU_API jack_port_t * | ju_port_rawget (ju_ctx_t *x, int p) |
Returns jack_port_t, associated with handle. More... | |
JU_API void ju_port_close | ( | ju_ctx_t * | x, |
int | p | ||
) |
Decreases reference counter of port, and destroys it, if refcounter == 0.
x | JackUtils context. |
p | port descriptor. |
References ju_ctx_s::client, get_port_s(), ju_port_s::not_unregister, ju_port_s::port, ju_ctx_s::ports, and ju_port_s::refcnt.
JU_API int ju_port_connected | ( | ju_ctx_t * | x, |
int | p | ||
) |
Returns number of connections to the port (or simply is port connected to anything)
x | JackUtils context. |
p | port descriptor. |
References get_port_j().
Finds port by full name.
This function can find not only ports owned by context.
x | context |
n | port name |
WARNING: founded port handle is already TAKEN, so fon't forget to CLOSE it, when you don't need this handle anymore! WARNING: This function CAN ONLY BE CALLED AFTER STARTING JACK AUDIO PROCESSING!
References ju_ctx_s::client, and ju_port_rawfind().
JU_API int ju_port_mine | ( | ju_ctx_t * | x, |
int | p | ||
) |
Returns is port owned by context.
x | JackUtils context |
p | port descriptor |
returns 1 only, and ONLY if port descriptor was not NOT created from RAW jack_port with nonzero not_own!
References ju_ctx_s::client, and get_port_j().
JU_API int ju_port_next | ( | ju_ctx_t * | x, |
int | p, | ||
enum ju_port_type | t | ||
) |
Returns next valid port descriptor, owned by JackUtils context.
x | context |
p | port descriptor |
t | search for input or output port |
WARNING: this function CLOSES given port handle before searching for next port! : Call port_take on firstly iteratable port handle! (or pass -1 as port handle)
Returned port descriptor already TAKEN! (refcnt increased). You MUST CLOSE port, when it is not needed for you anymore outside of the searching loop!
References is_input(), JU_INPUT, JU_OUTPUT, ju_port_close(), ju_port_mine(), ju_port_take(), ju_ctx_s::last_port, ju_port_s::port, and ju_ctx_s::ports.
JU_API int ju_port_open | ( | ju_ctx_t * | x, |
ju_cstr_t | n, | ||
enum ju_port_type | t, | ||
int | f | ||
) |
Creates new port, and returns port desriptor.
Jack ports are input or output points for single-channel audio data.
Ports returned by descriptors are safe abstraction above pointers. Valid ports descriptors are 0 .. JU_MAX_PORTS
x | jackUtils context |
n | port name. Same port names for single client are not allowed! |
t | input or output port type |
f | additional port flags (JackPortIsTerminal, for example) |
References ju_ctx_s::client, JU_INPUT, JU_OUTPUT, and ju_port_rawfind().
JU_API int ju_port_rawfind | ( | ju_ctx_t * | x, |
jack_port_t * | p, | ||
int | not_own | ||
) |
Finds existed port handle, or takes new port handle from jack_port_t.
LOWLEVEL API! Use this function ONLY to deal with another kinds of Jack Libraries.
x | JackUtils Context |
p | JACK PORT |
not_own | if == 1, JackUtils will not close this port and threat it as it's owned port. |
returned descriptor is already TAKEN! So you must to CLOSE it, when you don't need it anymore!
WARNING : jack_port_unregister will be called when both :
References JU_MAX_PORTS, ju_ctx_s::last_port, ju_port_s::port, ju_ctx_s::ports, and ju_port_s::refcnt.
JU_API jack_port_t * ju_port_rawget | ( | ju_ctx_t * | x, |
int | p | ||
) |
Returns jack_port_t, associated with handle.
(LOWLEVEL) Use this function ONLY to deal with another kinds of Jack Libraries.
x | JackUtils context |
p | port descriptor |
you MUST NOT UNREGISTER returned jack_port_t, or change it's ownership manually! It is Undefined Behaviour! Refcounter of port descriptor is NOT changed here!
References get_port_j().
JU_PROC const ju_sample_t *() ju_port_read | ( | ju_ctx_t * | x, |
int | p | ||
) |
Gets audio buffer from the port.
x | context |
p | port descriptor (with type JU_INPUT) |
This function can be called ONLY inside the Jack Audio Process Callback!
Theese data buffers are valid only until Audio Processs Callback is working.
Caching and acessing theese buffers later, or outside of Jack Audio Process Callback is Undefined Behaviour!
References get_port_j(), is_input(), and ju_length().
JU_API void ju_port_take | ( | ju_ctx_t * | x, |
int | p | ||
) |
Increases reference counter of port.
x | JackUtils context. |
p | port descriptor. |
References get_port_s(), and ju_port_s::refcnt.
JU_PROC size_t() ju_port_write | ( | ju_ctx_t * | x, |
int | p, | ||
const ju_sample_t * | a, | ||
size_t | l | ||
) |
Writes data to port with Output type from sample array.
x | context |
p | port descriptor |
a | array of ju_sample_t |
l | length of array a |
This function can be called ONLY inside the Audio Process Callback!
References get_port_j(), is_input(), and ju_length().
JU_PROC void() ju_port_write_stream | ( | ju_ctx_t * | x, |
int | p, | ||
ju_stream_func_t | s, | ||
void * | u | ||
) |
Writes data to port with Output type from stream callback.
x | context |
p | port descriptor |
s | stream callback |
u | userdata to the stream callback |
This function can be called ONLY inside the Audio Process Callback!