JackUtils 0.5
Provides simplified Jack API for clients :)
Loading...
Searching...
No Matches
ju_bits_ctx.h
Go to the documentation of this file.
1// see jackutils.h for details!
2
14#pragma once
15
17#define CLOSE_PORT_NAME "__close"
19#define JU_STAT static inline
21#define S_TO_MS(V) (V * 1000000)
22
28typedef struct ju_port_s {
29 jack_port_t* port;
30 uint16_t refcnt;
33
39struct ju_ctx_s {
40 jack_client_t* client;
41 jack_port_t* close;
46 mtx_t mutex;
47
52 mtx_t works;
53
57 mtx_t mdata;
58
63
65 size_t length;
67 size_t samplerate;
74
76 void* osc;
85 void* onsave_ud;
87 char* tmp; // don't use this!
88};
89
92 if (p < 0 || p > x->last_port || !x->ports[p].port) return NULL;
93 return x->ports + p;
94}
95
97JU_STAT jack_port_t* get_port_j(ju_ctx_t* x, int p) {
98 if (p < 0 || p > x->last_port || !x->ports[p].port) return NULL;
99 return x->ports[p].port;
100}
101
103JU_STAT int is_input(ju_ctx_t* x, int p) {
104 ju_port_t* r = get_port_s(x, p);
105 return r ? jack_port_flags(r->port) & JackPortIsInput : -1;
106}
107
108#define PORTGETS(X, I) (X->ports[I])
109#define PORTGETJ(X, I) PORTGETS(X, I).port
110
#define JU_MAX_PORTS
max ports descriptors count.
Definition: jackutils.h:46
unsigned char ju_uint8_t
Unsigned int definition...
Definition: jackutils.h:60
void(* ju_process_func_t)(ju_ctx_t *x, size_t s)
Jack Audio processing callback.
Definition: jackutils.h:92
int(* ju_save_cb)(ju_ctx_t *ctx, void *ud)
Save callback, that called each time when user sends save command from session manager,...
Definition: ju_osc.h:108
JU_STAT jack_port_t * get_port_j(ju_ctx_t *x, int p)
get jack_port_t by the given descriptor
Definition: ju_bits_ctx.h:97
JU_STAT int is_input(ju_ctx_t *x, int p)
check is port has JU_INPUT type by given descriptor
Definition: ju_bits_ctx.h:103
JU_STAT struct ju_port_s * get_port_s(ju_ctx_t *x, int p)
get internal port structure by the given descriptor
Definition: ju_bits_ctx.h:91
#define JU_STAT
reaability? what is this? :D
Definition: ju_bits_ctx.h:19
struct ju_port_s ju_port_t
internal JackUtils port structure.
Internal JackUtils context structure.
Definition: ju_bits_ctx.h:39
int gui_showed
protected with mutex mdata.
Definition: ju_bits_ctx.h:80
size_t samplerate
protected with mutex mdata
Definition: ju_bits_ctx.h:67
mtx_t works
This mutex is locked since ju_start called and until ju_stop is not called, or jack server/session ma...
Definition: ju_bits_ctx.h:52
char * tmp
I... Don't remember what the shit is this :D, but it protected with mdata mutex...
Definition: ju_bits_ctx.h:87
size_t length
protected with mutex mdata
Definition: ju_bits_ctx.h:65
int gui_supported
protected with mutex mdata.
Definition: ju_bits_ctx.h:82
ju_port_t ports[JU_MAX_PORTS+1]
protected with mutex mdata
Definition: ju_bits_ctx.h:73
char * session_path
protected with mutex mdata.
Definition: ju_bits_ctx.h:78
mtx_t mdata
mutex for samplerate, sample buffers length and etc.
Definition: ju_bits_ctx.h:57
void * osc
protected with mutex mdata.
Definition: ju_bits_ctx.h:76
jack_client_t * client
JACK client.
Definition: ju_bits_ctx.h:40
ju_save_cb onsave
save callback and user data for it
Definition: ju_bits_ctx.h:84
ju_uint8_t last_port
protected with mutex mdata
Definition: ju_bits_ctx.h:71
mtx_t mutex
this mutex is locked while Jack Audio Process callback is running :)
Definition: ju_bits_ctx.h:46
ju_process_func_t proc_cb
Jack Audio Processing User Callback :)
Definition: ju_bits_ctx.h:62
jack_port_t * close
JACK close port :D, created if connection to the session manager fails.
Definition: ju_bits_ctx.h:41
ju_uint8_t connected_ports_cnt
protected with mutex mdata
Definition: ju_bits_ctx.h:69
internal JackUtils port structure.
Definition: ju_bits_ctx.h:28
bool not_unregister
false in most cases :/
Definition: ju_bits_ctx.h:31
jack_port_t * port
JACK port.
Definition: ju_bits_ctx.h:29
uint16_t refcnt
reference counter
Definition: ju_bits_ctx.h:30