jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

999 lines
46KB

  1. /*
  2. Copyright (C) 2006 Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #include "jack.h"
  16. #include "JackExports.h"
  17. #include <dlfcn.h>
  18. #include <stdarg.h>
  19. #include <stdio.h>
  20. #include <dirent.h>
  21. #include <string.h>
  22. #ifdef __cplusplus
  23. extern "C"
  24. {
  25. #endif
  26. EXPORT int jack_client_name_size (void);
  27. EXPORT char* jack_get_client_name (jack_client_t *client);
  28. EXPORT int jack_internal_client_new (const char *client_name,
  29. const char *load_name,
  30. const char *load_init);
  31. EXPORT jack_client_t* my_jack_internal_client_new(const char* client_name, const char* dll_name, const char* object_data);
  32. EXPORT void jack_internal_client_close (const char *client_name);
  33. EXPORT void my_jack_internal_client_close (jack_client_t* client);
  34. EXPORT int jack_is_realtime (jack_client_t *client);
  35. EXPORT void jack_on_shutdown (jack_client_t *client,
  36. void (*function)(void *arg), void *arg);
  37. EXPORT int jack_set_process_callback (jack_client_t *client,
  38. JackProcessCallback process_callback,
  39. void *arg);
  40. EXPORT int jack_set_thread_init_callback (jack_client_t *client,
  41. JackThreadInitCallback thread_init_callback,
  42. void *arg);
  43. EXPORT int jack_set_freewheel_callback (jack_client_t *client,
  44. JackFreewheelCallback freewheel_callback,
  45. void *arg);
  46. EXPORT int jack_set_freewheel(jack_client_t* client, int onoff);
  47. EXPORT int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes);
  48. EXPORT int jack_set_buffer_size_callback (jack_client_t *client,
  49. JackBufferSizeCallback bufsize_callback,
  50. void *arg);
  51. EXPORT int jack_set_sample_rate_callback (jack_client_t *client,
  52. JackSampleRateCallback srate_callback,
  53. void *arg);
  54. EXPORT int jack_set_port_registration_callback (jack_client_t *,
  55. JackPortRegistrationCallback
  56. registration_callback, void *arg);
  57. EXPORT int jack_set_graph_order_callback (jack_client_t *,
  58. JackGraphOrderCallback graph_callback,
  59. void *);
  60. EXPORT int jack_set_xrun_callback (jack_client_t *,
  61. JackXRunCallback xrun_callback, void *arg);
  62. EXPORT int jack_activate (jack_client_t *client);
  63. EXPORT int jack_deactivate (jack_client_t *client);
  64. EXPORT jack_port_t * jack_port_register (jack_client_t *client,
  65. const char *port_name,
  66. const char *port_type,
  67. unsigned long flags,
  68. unsigned long buffer_size);
  69. EXPORT int jack_port_unregister (jack_client_t *, jack_port_t *);
  70. EXPORT void * jack_port_get_buffer (jack_port_t *, jack_nframes_t);
  71. EXPORT const char * jack_port_name (const jack_port_t *port);
  72. EXPORT const char * jack_port_short_name (const jack_port_t *port);
  73. EXPORT int jack_port_flags (const jack_port_t *port);
  74. EXPORT const char * jack_port_type (const jack_port_t *port);
  75. EXPORT int jack_port_is_mine (const jack_client_t *, const jack_port_t *port);
  76. EXPORT int jack_port_connected (const jack_port_t *port);
  77. EXPORT int jack_port_connected_to (const jack_port_t *port,
  78. const char *port_name);
  79. EXPORT const char ** jack_port_get_connections (const jack_port_t *port);
  80. EXPORT const char ** jack_port_get_all_connections (const jack_client_t *client,
  81. const jack_port_t *port);
  82. EXPORT int jack_port_tie (jack_port_t *src, jack_port_t *dst);
  83. EXPORT int jack_port_untie (jack_port_t *port);
  84. EXPORT int jack_port_lock (jack_client_t *, jack_port_t *);
  85. EXPORT int jack_port_unlock (jack_client_t *, jack_port_t *);
  86. EXPORT jack_nframes_t jack_port_get_latency (jack_port_t *port);
  87. EXPORT jack_nframes_t jack_port_get_total_latency (jack_client_t *,
  88. jack_port_t *port);
  89. EXPORT void jack_port_set_latency (jack_port_t *, jack_nframes_t);
  90. EXPORT int jack_recompute_total_latencies (jack_client_t*);
  91. EXPORT int jack_port_set_name (jack_port_t *port, const char *port_name);
  92. EXPORT int jack_port_request_monitor (jack_port_t *port, int onoff);
  93. EXPORT int jack_port_request_monitor_by_name (jack_client_t *client,
  94. const char *port_name, int onoff);
  95. EXPORT int jack_port_ensure_monitor (jack_port_t *port, int onoff);
  96. EXPORT int jack_port_monitoring_input (jack_port_t *port);
  97. EXPORT int jack_connect (jack_client_t *,
  98. const char *source_port,
  99. const char *destination_port);
  100. EXPORT int jack_disconnect (jack_client_t *,
  101. const char *source_port,
  102. const char *destination_port);
  103. EXPORT int jack_port_disconnect (jack_client_t *, jack_port_t *);
  104. EXPORT int jack_port_name_size(void);
  105. EXPORT int jack_port_type_size(void);
  106. EXPORT jack_nframes_t jack_get_sample_rate (jack_client_t *);
  107. EXPORT jack_nframes_t jack_get_buffer_size (jack_client_t *);
  108. EXPORT const char ** jack_get_ports (jack_client_t *,
  109. const char *port_name_pattern,
  110. const char *type_name_pattern,
  111. unsigned long flags);
  112. EXPORT jack_port_t * jack_port_by_name (jack_client_t *, const char *port_name);
  113. EXPORT jack_port_t * jack_port_by_id (jack_client_t *client,
  114. jack_port_id_t port_id);
  115. EXPORT int jack_engine_takeover_timebase (jack_client_t *);
  116. EXPORT jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *);
  117. EXPORT jack_nframes_t jack_frame_time (const jack_client_t *);
  118. EXPORT jack_nframes_t jack_last_frame_time (const jack_client_t *client);
  119. EXPORT float jack_cpu_load (jack_client_t *client);
  120. EXPORT pthread_t jack_client_thread_id (jack_client_t *);
  121. EXPORT void jack_set_error_function (void (*func)(const char *));
  122. EXPORT float jack_get_max_delayed_usecs (jack_client_t *client);
  123. EXPORT float jack_get_xrun_delayed_usecs (jack_client_t *client);
  124. EXPORT void jack_reset_max_delayed_usecs (jack_client_t *client);
  125. EXPORT int jack_release_timebase (jack_client_t *client);
  126. EXPORT int jack_set_sync_callback (jack_client_t *client,
  127. JackSyncCallback sync_callback,
  128. void *arg);
  129. EXPORT int jack_set_sync_timeout (jack_client_t *client,
  130. jack_time_t timeout);
  131. EXPORT int jack_set_timebase_callback (jack_client_t *client,
  132. int conditional,
  133. JackTimebaseCallback timebase_callback,
  134. void *arg);
  135. EXPORT int jack_transport_locate (jack_client_t *client,
  136. jack_nframes_t frame);
  137. EXPORT jack_transport_state_t jack_transport_query (const jack_client_t *client,
  138. jack_position_t *pos);
  139. EXPORT jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client);
  140. EXPORT int jack_transport_reposition (jack_client_t *client,
  141. jack_position_t *pos);
  142. EXPORT void jack_transport_start (jack_client_t *client);
  143. EXPORT void jack_transport_stop (jack_client_t *client);
  144. EXPORT void jack_get_transport_info (jack_client_t *client,
  145. jack_transport_info_t *tinfo);
  146. EXPORT void jack_set_transport_info (jack_client_t *client,
  147. jack_transport_info_t *tinfo);
  148. EXPORT int jack_acquire_real_time_scheduling (pthread_t thread, int priority);
  149. EXPORT int jack_client_create_thread (jack_client_t* client,
  150. pthread_t *thread,
  151. int priority,
  152. int realtime, // boolean
  153. void *(*start_routine)(void*),
  154. void *arg);
  155. EXPORT int jack_drop_real_time_scheduling (pthread_t thread);
  156. EXPORT char * jack_get_internal_client_name (jack_client_t *client,
  157. jack_intclient_t intclient);
  158. EXPORT jack_intclient_t jack_internal_client_handle (jack_client_t *client,
  159. const char *client_name,
  160. jack_status_t *status);
  161. EXPORT jack_intclient_t jack_internal_client_load (jack_client_t *client,
  162. const char *client_name,
  163. jack_options_t options,
  164. jack_status_t *status, ...);
  165. EXPORT jack_status_t jack_internal_client_unload (jack_client_t *client,
  166. jack_intclient_t intclient);
  167. EXPORT jack_client_t * jack_client_open (const char *client_name,
  168. jack_options_t options,
  169. jack_status_t *status, ...);
  170. EXPORT jack_client_t * jack_client_new (const char *client_name);
  171. EXPORT int jack_client_close (jack_client_t *client);
  172. #ifdef __cplusplus
  173. }
  174. #endif
  175. // Function definition
  176. typedef void* (*jack_port_get_buffer_fun_def)(jack_port_t* port, jack_nframes_t frames);
  177. static jack_port_get_buffer_fun_def jack_port_get_buffer_fun = 0;
  178. EXPORT void* jack_port_get_buffer(jack_port_t* port, jack_nframes_t frames)
  179. {
  180. return (*jack_port_get_buffer_fun)(port, frames);
  181. }
  182. typedef const char* (*jack_port_name_fun_def)(const jack_port_t* port);
  183. static jack_port_name_fun_def jack_port_name_fun = 0;
  184. EXPORT const char* jack_port_name(const jack_port_t* port)
  185. {
  186. return (*jack_port_name_fun)(port);
  187. }
  188. typedef const char* (*jack_port_short_name_fun_def) (const jack_port_t* port);
  189. static jack_port_short_name_fun_def jack_port_short_name_fun = 0;
  190. EXPORT const char* jack_port_short_name(const jack_port_t* port)
  191. {
  192. return (*jack_port_short_name_fun)(port);
  193. }
  194. typedef int (*jack_port_flags_fun_def)(const jack_port_t* port);
  195. static jack_port_flags_fun_def jack_port_flags_fun = 0;
  196. EXPORT int jack_port_flags(const jack_port_t* port)
  197. {
  198. return (*jack_port_flags_fun)(port);
  199. }
  200. typedef const char* (*jack_port_type_fun_def)(const jack_port_t* port);
  201. static jack_port_type_fun_def jack_port_type_fun = 0;
  202. EXPORT const char* jack_port_type(const jack_port_t* port)
  203. {
  204. return (*jack_port_type_fun)(port);
  205. }
  206. typedef int (*jack_port_connected_fun_def)(const jack_port_t* port);
  207. static jack_port_connected_fun_def jack_port_connected_fun = 0;
  208. EXPORT int jack_port_connected(const jack_port_t* port)
  209. {
  210. return (*jack_port_connected_fun)(port);
  211. }
  212. typedef int (*jack_port_connected_to_fun_def)(const jack_port_t* port, const char* portname);
  213. static jack_port_connected_to_fun_def jack_port_connected_to_fun = 0;
  214. EXPORT int jack_port_connected_to(const jack_port_t* port, const char* portname)
  215. {
  216. return (*jack_port_connected_to_fun)(port, portname);
  217. }
  218. typedef int (*jack_port_tie_fun_def)(jack_port_t* src, jack_port_t* dst);
  219. static jack_port_tie_fun_def jack_port_tie_fun = 0;
  220. EXPORT int jack_port_tie(jack_port_t* src, jack_port_t* dst)
  221. {
  222. return (*jack_port_tie_fun)(src, dst);
  223. }
  224. typedef int (*jack_port_untie_fun_def)(jack_port_t* port);
  225. static jack_port_untie_fun_def jack_port_untie_fun = 0;
  226. EXPORT int jack_port_untie(jack_port_t* port)
  227. {
  228. return (*jack_port_untie_fun)(port);
  229. }
  230. typedef jack_nframes_t (*jack_port_get_latency_fun_def)(jack_port_t* port);
  231. static jack_port_get_latency_fun_def jack_port_get_latency_fun = 0;
  232. EXPORT jack_nframes_t jack_port_get_latency(jack_port_t* port)
  233. {
  234. return (*jack_port_get_latency)(port);
  235. }
  236. typedef void (*jack_port_set_latency_fun_def)(jack_port_t* port, jack_nframes_t frames);
  237. static jack_port_set_latency_fun_def jack_port_set_latency_fun = 0;
  238. EXPORT void jack_port_set_latency(jack_port_t* port, jack_nframes_t frames)
  239. {
  240. (*jack_port_set_latency_fun)(port, frames);
  241. }
  242. typedef int (*jack_recompute_total_latencies_fun_def)(jack_client_t* ext_client);
  243. static jack_recompute_total_latencies_fun_def jack_recompute_total_latencies_fun = 0;
  244. EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client)
  245. {
  246. return (*jack_recompute_total_latencies_fun)(ext_client);
  247. }
  248. typedef int (*jack_port_set_name_fun_def)(jack_port_t* port, const char* name);
  249. static jack_port_set_name_fun_def jack_port_set_name_fun = 0;
  250. EXPORT int jack_port_set_name(jack_port_t* port, const char* name)
  251. {
  252. return (*jack_port_set_name_fun)(port, name);
  253. }
  254. typedef int (*jack_port_request_monitor_fun_def)(jack_port_t* port, int onoff);
  255. static jack_port_request_monitor_fun_def jack_port_request_monitor_fun = 0;
  256. EXPORT int jack_port_request_monitor(jack_port_t* port, int onoff)
  257. {
  258. return (*jack_port_request_monitor_fun)(port, onoff);
  259. }
  260. typedef int (*jack_port_request_monitor_by_name_fun_def)(jack_client_t* ext_client, const char* port_name, int onoff);
  261. static jack_port_request_monitor_by_name_fun_def jack_port_request_monitor_by_name_fun = 0;
  262. EXPORT int jack_port_request_monitor_by_name(jack_client_t* ext_client, const char* port_name, int onoff)
  263. {
  264. return (*jack_port_request_monitor_by_name_fun)(ext_client, port_name, onoff);
  265. }
  266. typedef int (*jack_port_ensure_monitor_fun_def)(jack_port_t* port, int onoff);
  267. static jack_port_ensure_monitor_fun_def jack_port_ensure_monitor_fun = 0;
  268. EXPORT int jack_port_ensure_monitor(jack_port_t* port, int onoff)
  269. {
  270. return (*jack_port_ensure_monitor_fun)(port, onoff);
  271. }
  272. typedef int (*jack_port_monitoring_input_fun_def)(jack_port_t* port);
  273. static jack_port_monitoring_input_fun_def jack_port_monitoring_input_fun = 0;
  274. EXPORT int jack_port_monitoring_input(jack_port_t* port)
  275. {
  276. return (*jack_port_monitoring_input_fun)(port);
  277. }
  278. typedef int (*jack_is_realtime_fun_def)(jack_client_t* ext_client);
  279. static jack_is_realtime_fun_def jack_is_realtime_fun = 0;
  280. EXPORT int jack_is_realtime(jack_client_t* ext_client)
  281. {
  282. return (*jack_is_realtime_fun)(ext_client);
  283. }
  284. typedef void (*shutdown_fun)(void* arg);
  285. typedef void (*jack_on_shutdown_fun_def)(jack_client_t* ext_client, shutdown_fun callback, void* arg);
  286. static jack_on_shutdown_fun_def jack_on_shutdown_fun = 0;
  287. EXPORT void jack_on_shutdown(jack_client_t* ext_client, shutdown_fun callback, void* arg)
  288. {
  289. return (*jack_on_shutdown_fun)(ext_client, callback, arg);
  290. }
  291. typedef int (*jack_set_process_callback_fun_def)(jack_client_t* ext_client, JackProcessCallback callback, void* arg);
  292. static jack_set_process_callback_fun_def jack_set_process_callback_fun = 0;
  293. EXPORT int jack_set_process_callback(jack_client_t* ext_client, JackProcessCallback callback, void* arg)
  294. {
  295. return (*jack_set_process_callback_fun)(ext_client, callback, arg);
  296. }
  297. typedef int (*jack_set_freewheel_callback_fun_def)(jack_client_t* ext_client, JackFreewheelCallback freewheel_callback, void* arg);
  298. static jack_set_freewheel_callback_fun_def jack_set_freewheel_callback_fun = 0;
  299. EXPORT int jack_set_freewheel_callback(jack_client_t* ext_client, JackFreewheelCallback freewheel_callback, void* arg)
  300. {
  301. return (*jack_set_freewheel_callback_fun)(ext_client, freewheel_callback, arg);
  302. }
  303. typedef int (*jack_set_freewheel_fun_def)(jack_client_t* ext_client, int onoff);
  304. static jack_set_freewheel_fun_def jack_set_freewheel_fun = 0;
  305. EXPORT int jack_set_freewheel(jack_client_t* ext_client, int onoff)
  306. {
  307. return (*jack_set_freewheel_fun)(ext_client, onoff);
  308. }
  309. typedef int (*jack_set_buffer_size_fun_def)(jack_client_t* ext_client, jack_nframes_t buffer_size);
  310. static jack_set_buffer_size_fun_def jack_set_buffer_size_fun = 0;
  311. EXPORT int jack_set_buffer_size(jack_client_t* ext_client, jack_nframes_t buffer_size)
  312. {
  313. return (*jack_set_buffer_size_fun)(ext_client, buffer_size);
  314. }
  315. typedef int (*jack_set_buffer_size_callback_fun_def)(jack_client_t* ext_client, JackBufferSizeCallback bufsize_callback, void* arg);
  316. static jack_set_buffer_size_callback_fun_def jack_set_buffer_size_callback_fun = 0;
  317. EXPORT int jack_set_buffer_size_callback(jack_client_t* ext_client, JackBufferSizeCallback bufsize_callback, void* arg)
  318. {
  319. return (*jack_set_buffer_size_callback_fun)(ext_client, bufsize_callback, arg);
  320. }
  321. typedef int (*jack_set_sample_rate_callback_fun_def)(jack_client_t* ext_client, JackSampleRateCallback srate_callback, void* arg);
  322. static jack_set_sample_rate_callback_fun_def jack_set_sample_rate_callback_fun = 0;
  323. EXPORT int jack_set_sample_rate_callback(jack_client_t* ext_client, JackSampleRateCallback srate_callback, void* arg)
  324. {
  325. return (*jack_set_sample_rate_callback_fun)(ext_client, srate_callback, arg);
  326. }
  327. typedef int (*jack_set_port_registration_callback_fun_def)(jack_client_t* ext_client, JackPortRegistrationCallback registration_callback, void* arg);
  328. static jack_set_port_registration_callback_fun_def jack_set_port_registration_callback_fun = 0;
  329. EXPORT int jack_set_port_registration_callback(jack_client_t* ext_client, JackPortRegistrationCallback registration_callback, void* arg)
  330. {
  331. return (*jack_set_port_registration_callback_fun)(ext_client, registration_callback, arg);
  332. }
  333. typedef int (*jack_set_graph_order_callback_fun_def)(jack_client_t* ext_client, JackGraphOrderCallback graph_callback, void* arg);
  334. static jack_set_graph_order_callback_fun_def jack_set_graph_order_callback_fun = 0;
  335. EXPORT int jack_set_graph_order_callback(jack_client_t* ext_client, JackGraphOrderCallback graph_callback, void* arg)
  336. {
  337. return (*jack_set_graph_order_callback_fun)(ext_client, graph_callback, arg);
  338. }
  339. typedef int (*jack_set_xrun_callback_fun_def)(jack_client_t* ext_client, JackXRunCallback xrun_callback, void* arg);
  340. static jack_set_xrun_callback_fun_def jack_set_xrun_callback_fun = 0;
  341. EXPORT int jack_set_xrun_callback(jack_client_t* ext_client, JackXRunCallback xrun_callback, void* arg)
  342. {
  343. return (*jack_set_xrun_callback_fun)(ext_client, xrun_callback, arg);
  344. }
  345. typedef int (*jack_set_thread_init_callback_fun_def)(jack_client_t* ext_client, JackThreadInitCallback init_callback, void *arg);
  346. static jack_set_thread_init_callback_fun_def jack_set_thread_init_callback_fun = 0;
  347. EXPORT int jack_set_thread_init_callback(jack_client_t* ext_client, JackThreadInitCallback init_callback, void *arg)
  348. {
  349. return (*jack_set_thread_init_callback_fun)(ext_client, init_callback, arg);
  350. }
  351. typedef int (*jack_activate_fun_def)(jack_client_t* ext_client);
  352. static jack_activate_fun_def jack_activate_fun = 0;
  353. EXPORT int jack_activate(jack_client_t* ext_client)
  354. {
  355. return (*jack_activate_fun)(ext_client);
  356. }
  357. typedef int (*jack_deactivate_fun_def)(jack_client_t* ext_client);
  358. static jack_deactivate_fun_def jack_deactivate_fun = 0;
  359. EXPORT int jack_deactivate(jack_client_t* ext_client)
  360. {
  361. return (*jack_deactivate_fun)(ext_client);
  362. }
  363. typedef jack_port_t* (*jack_port_register_fun_def)(jack_client_t* ext_client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size);
  364. static jack_port_register_fun_def jack_port_register_fun = 0;
  365. EXPORT jack_port_t* jack_port_register(jack_client_t* ext_client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size)
  366. {
  367. return (*jack_port_register_fun)(ext_client, port_name, port_type, flags, buffer_size);
  368. }
  369. typedef int (*jack_port_unregister_fun_def)(jack_client_t* ext_client, jack_port_t* port);
  370. static jack_port_unregister_fun_def jack_port_unregister_fun = 0;
  371. EXPORT int jack_port_unregister(jack_client_t* ext_client, jack_port_t* port)
  372. {
  373. return (*jack_port_unregister_fun)(ext_client, port);
  374. }
  375. typedef int (*jack_port_is_mine_fun_def)(const jack_client_t* ext_client, const jack_port_t* port);
  376. static jack_port_is_mine_fun_def jack_port_is_mine_fun = 0;
  377. EXPORT int jack_port_is_mine(const jack_client_t* ext_client, const jack_port_t* port)
  378. {
  379. return (*jack_port_is_mine_fun)(ext_client, port);
  380. }
  381. typedef const char** (*jack_port_get_connections_fun_def)(const jack_port_t* port);
  382. static jack_port_get_connections_fun_def jack_port_get_connections_fun = 0;
  383. EXPORT const char** jack_port_get_connections(const jack_port_t* port)
  384. {
  385. return (*jack_port_get_connections_fun)(port);
  386. }
  387. // Calling client does not need to "own" the port
  388. typedef const char** (*jack_port_get_all_connections_fun_def)(const jack_client_t* ext_client, const jack_port_t* port);
  389. static jack_port_get_all_connections_fun_def jack_port_get_all_connections_fun = 0;
  390. EXPORT const char** jack_port_get_all_connections(const jack_client_t* ext_client, const jack_port_t* port)
  391. {
  392. return (*jack_port_get_all_connections_fun)(ext_client, port);
  393. }
  394. // Does not use the client parameter
  395. typedef int (*jack_port_lock_fun_def)(jack_client_t* ext_client, jack_port_t* port);
  396. static jack_port_lock_fun_def jack_port_lock_fun = 0;
  397. EXPORT int jack_port_lock(jack_client_t* ext_client, jack_port_t* port)
  398. {
  399. return (*jack_port_lock_fun)(ext_client, port);
  400. }
  401. // Does not use the client parameter
  402. typedef int (*jack_port_unlock_fun_def)(jack_client_t* ext_client, jack_port_t* port);
  403. static jack_port_unlock_fun_def jack_port_unlock_fun = 0;
  404. EXPORT int jack_port_ununlock(jack_client_t* ext_client, jack_port_t* port)
  405. {
  406. return (*jack_port_unlock_fun)(ext_client, port);
  407. }
  408. typedef jack_nframes_t (*jack_port_get_total_latency_fun_def)(jack_client_t* ext_client, jack_port_t* port);
  409. static jack_port_get_total_latency_fun_def jack_port_get_total_latency_fun = 0;
  410. EXPORT jack_nframes_t jack_port_get_total_latency(jack_client_t* ext_client, jack_port_t* port)
  411. {
  412. return (*jack_port_get_total_latency_fun)(ext_client, port);
  413. }
  414. typedef int (*jack_connect_fun_def)(jack_client_t* ext_client, const char* src, const char* dst);
  415. static jack_connect_fun_def jack_connect_fun = 0;
  416. EXPORT int jack_connect(jack_client_t* ext_client, const char* src, const char* dst)
  417. {
  418. return (*jack_connect_fun)(ext_client, src, dst);
  419. }
  420. typedef int (*jack_disconnect_fun_def)(jack_client_t* ext_client, const char* src, const char* dst);
  421. static jack_disconnect_fun_def jack_disconnect_fun = 0;
  422. EXPORT int jack_disconnect(jack_client_t* ext_client, const char* src, const char* dst)
  423. {
  424. return (*jack_disconnect_fun)(ext_client, src, dst);
  425. }
  426. typedef int (*jack_port_connect_fun_def)(jack_client_t* ext_client, jack_port_t* src, jack_port_t* dst);
  427. static jack_port_connect_fun_def jack_port_connect_fun = 0;
  428. EXPORT int jack_port_connect(jack_client_t* ext_client, jack_port_t* src, jack_port_t* dst)
  429. {
  430. return (*jack_port_connect_fun)(ext_client, src, dst);
  431. }
  432. typedef int (*jack_port_disconnect_fun_def)(jack_client_t* ext_client, jack_port_t* src);
  433. static jack_port_disconnect_fun_def jack_port_disconnect_fun = 0;
  434. EXPORT int jack_port_disconnect(jack_client_t* ext_client, jack_port_t* src)
  435. {
  436. return (*jack_port_disconnect_fun)(ext_client, src);
  437. }
  438. typedef jack_nframes_t (*jack_get_sample_rate_fun_def)(jack_client_t* ext_client);
  439. static jack_get_sample_rate_fun_def jack_get_sample_rate_fun = 0;
  440. EXPORT jack_nframes_t jack_get_sample_rate(jack_client_t* ext_client)
  441. {
  442. return (*jack_get_sample_rate_fun)(ext_client);
  443. }
  444. typedef jack_nframes_t (*jack_get_buffer_size_fun_def)(jack_client_t* ext_client);
  445. static jack_get_buffer_size_fun_def jack_get_buffer_size_fun = 0;
  446. EXPORT jack_nframes_t jack_get_buffer_size(jack_client_t* ext_client)
  447. {
  448. return (*jack_get_buffer_size_fun)(ext_client);
  449. }
  450. typedef const char** (*jack_get_ports_fun_def)(jack_client_t* ext_client, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
  451. static jack_get_ports_fun_def jack_get_ports_fun = 0;
  452. EXPORT const char** jack_get_ports(jack_client_t* ext_client, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags)
  453. {
  454. return (*jack_get_ports_fun)(ext_client, port_name_pattern, type_name_pattern, flags);
  455. }
  456. typedef jack_port_t* (*jack_port_by_name_fun_def)(jack_client_t* ext_client, const char* portname);
  457. static jack_port_by_name_fun_def jack_port_by_name_fun = 0;
  458. EXPORT jack_port_t* jack_port_by_name(jack_client_t* ext_client, const char* portname)
  459. {
  460. return (*jack_port_by_name_fun)(ext_client, portname);
  461. }
  462. typedef jack_port_t* (*jack_port_by_id_fun_def)(const jack_client_t* ext_client, jack_port_id_t id);
  463. static jack_port_by_id_fun_def jack_port_by_id_fun = 0;
  464. EXPORT jack_port_t* jack_port_by_id(const jack_client_t* ext_client, jack_port_id_t id)
  465. {
  466. return (*jack_port_by_id_fun)(ext_client, id);
  467. }
  468. typedef int (*jack_engine_takeover_timebase_fun_def)(jack_client_t* ext_client);
  469. static jack_engine_takeover_timebase_fun_def jack_engine_takeover_timebase_fun = 0;
  470. EXPORT int jack_engine_takeover_timebase(jack_client_t* ext_client)
  471. {
  472. return (*jack_engine_takeover_timebase_fun)(ext_client);
  473. }
  474. typedef jack_nframes_t (*jack_frames_since_cycle_start_fun_def)(const jack_client_t* ext_client);
  475. static jack_frames_since_cycle_start_fun_def jack_frames_since_cycle_start_fun = 0;
  476. EXPORT jack_nframes_t jack_frames_since_cycle_start(const jack_client_t* ext_client)
  477. {
  478. return (*jack_frames_since_cycle_start_fun)(ext_client);
  479. }
  480. typedef jack_nframes_t (*jack_frame_time_fun_def)(const jack_client_t* ext_client);
  481. static jack_frame_time_fun_def jack_frame_time_fun = 0;
  482. EXPORT jack_nframes_t jack_frame_time(const jack_client_t* ext_client)
  483. {
  484. return (*jack_frame_time_fun)(ext_client);
  485. }
  486. typedef jack_nframes_t (*jack_last_frame_time_fun_def)(const jack_client_t* ext_client);
  487. static jack_last_frame_time_fun_def jack_last_frame_time_fun = 0;
  488. EXPORT jack_nframes_t jack_last_frame_time(const jack_client_t* ext_client)
  489. {
  490. return (*jack_last_frame_time_fun)(ext_client);
  491. }
  492. typedef float (*jack_cpu_load_fun_def)(jack_client_t* ext_client);
  493. static jack_cpu_load_fun_def jack_cpu_load_fun = 0;
  494. EXPORT float jack_cpu_load(jack_client_t* ext_client)
  495. {
  496. return (*jack_cpu_load_fun)(ext_client);
  497. }
  498. typedef pthread_t (*jack_client_thread_id_fun_def)(jack_client_t* ext_client);
  499. static jack_client_thread_id_fun_def jack_client_thread_id_fun = 0;
  500. EXPORT pthread_t jack_client_thread_id(jack_client_t* ext_client)
  501. {
  502. return (*jack_client_thread_id_fun)(ext_client);
  503. }
  504. typedef char* (*jack_get_client_name_fun_def)(jack_client_t* ext_client);
  505. static jack_get_client_name_fun_def jack_get_client_name_fun = 0;
  506. EXPORT char* jack_get_client_name (jack_client_t* ext_client)
  507. {
  508. return (*jack_get_client_name_fun)(ext_client);
  509. }
  510. typedef int (*jack_client_name_size_fun_def)(void);
  511. static jack_client_name_size_fun_def jack_client_name_size_fun = 0;
  512. EXPORT int jack_client_name_size(void)
  513. {
  514. return (*jack_client_name_size_fun)();
  515. }
  516. typedef int (*jack_port_name_size_fun_def)(void);
  517. static jack_port_name_size_fun_def jack_port_name_size_fun = 0;
  518. EXPORT int jack_port_name_size(void)
  519. {
  520. return (*jack_port_name_size_fun)();
  521. }
  522. // transport.h
  523. typedef int (*jack_release_timebase_fun_def)(jack_client_t* ext_client);
  524. static jack_release_timebase_fun_def jack_release_timebase_fun = 0;
  525. EXPORT int jack_release_timebase(jack_client_t* ext_client)
  526. {
  527. return (*jack_release_timebase_fun)(ext_client);
  528. }
  529. typedef int (*jack_set_sync_callback_fun_def)(jack_client_t* ext_client, JackSyncCallback sync_callback, void *arg);
  530. static jack_set_sync_callback_fun_def jack_set_sync_callback_fun = 0;
  531. EXPORT int jack_set_sync_callback(jack_client_t* ext_client, JackSyncCallback sync_callback, void *arg)
  532. {
  533. return (*jack_set_sync_callback_fun)(ext_client, sync_callback, arg);
  534. }
  535. typedef int (*jack_set_sync_timeout_fun_def)(jack_client_t* ext_client, jack_time_t timeout);
  536. static jack_set_sync_timeout_fun_def jack_set_sync_timeout_fun = 0;
  537. EXPORT int jack_set_sync_timeout(jack_client_t* ext_client, jack_time_t timeout)
  538. {
  539. return (*jack_set_sync_timeout_fun)(ext_client, timeout);
  540. }
  541. typedef int (*jack_set_timebase_callback_fun_def)(jack_client_t* ext_client, int conditional, JackTimebaseCallback timebase_callback, void* arg);
  542. static jack_set_timebase_callback_fun_def jack_set_timebase_callback_fun = 0;
  543. EXPORT int jack_set_timebase_callback(jack_client_t* ext_client, int conditional, JackTimebaseCallback timebase_callback, void* arg)
  544. {
  545. return (*jack_set_timebase_callback_fun)(ext_client, conditional, timebase_callback, arg);
  546. }
  547. typedef int (*jack_transport_locate_fun_def)(jack_client_t* ext_client, jack_nframes_t frame);
  548. static jack_transport_locate_fun_def jack_transport_locate_fun = 0;
  549. EXPORT int jack_transport_locate(jack_client_t* ext_client, jack_nframes_t frame)
  550. {
  551. return (*jack_transport_locate_fun)(ext_client, frame);
  552. }
  553. typedef jack_transport_state_t (*jack_transport_query_fun_def)(const jack_client_t* ext_client, jack_position_t* pos);
  554. static jack_transport_query_fun_def jack_transport_query_fun = 0;
  555. EXPORT jack_transport_state_t jack_transport_query(const jack_client_t* ext_client, jack_position_t* pos)
  556. {
  557. return (*jack_transport_query_fun)(ext_client, pos);
  558. }
  559. typedef jack_nframes_t (*jack_get_current_transport_frame_fun_def)(const jack_client_t* ext_client);
  560. static jack_get_current_transport_frame_fun_def jack_get_current_transport_frame_fun = 0;
  561. EXPORT jack_nframes_t jack_get_current_transport_frame(const jack_client_t* ext_client)
  562. {
  563. return (*jack_get_current_transport_frame_fun)(ext_client);
  564. }
  565. typedef int (*jack_transport_reposition_fun_def)(jack_client_t* ext_client, jack_position_t* pos);
  566. static jack_transport_reposition_fun_def jack_transport_reposition_fun = 0;
  567. EXPORT int jack_transport_reposition(jack_client_t* ext_client, jack_position_t* pos)
  568. {
  569. return (*jack_transport_reposition_fun)(ext_client, pos);
  570. }
  571. typedef void (*jack_transport_start_fun_def)(jack_client_t* ext_client);
  572. static jack_transport_start_fun_def jack_transport_start_fun = 0;
  573. EXPORT void jack_transport_start(jack_client_t* ext_client)
  574. {
  575. return (*jack_transport_start_fun)(ext_client);
  576. }
  577. typedef void (*jack_transport_stop_fun_def)(jack_client_t* ext_client);
  578. static jack_transport_stop_fun_def jack_transport_stop_fun = 0;
  579. EXPORT void jack_transport_stop(jack_client_t* ext_client)
  580. {
  581. return (*jack_transport_stop_fun)(ext_client);
  582. }
  583. // deprecated
  584. typedef void (*jack_get_transport_info_fun_def)(jack_client_t* ext_client, jack_transport_info_t* tinfo);
  585. static jack_get_transport_info_fun_def jack_get_transport_info_fun = 0;
  586. EXPORT void jack_get_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo)
  587. {
  588. (*jack_get_transport_info_fun)(ext_client, tinfo);
  589. }
  590. typedef void (*jack_set_transport_info_fun_def)(jack_client_t* ext_client, jack_transport_info_t* tinfo);
  591. static jack_set_transport_info_fun_def jack_set_transport_info_fun = 0;
  592. EXPORT void jack_set_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo)
  593. {
  594. (*jack_set_transport_info_fun)(ext_client, tinfo);
  595. }
  596. // statistics.h
  597. typedef float (*jack_get_max_delayed_usecs_fun_def)(jack_client_t* ext_client);
  598. static jack_get_max_delayed_usecs_fun_def jack_get_max_delayed_usecs_fun = 0;
  599. EXPORT float jack_get_max_delayed_usecs(jack_client_t* ext_client)
  600. {
  601. return (*jack_get_max_delayed_usecs_fun)(ext_client);
  602. }
  603. typedef float (*jack_get_xrun_delayed_usecs_fun_def)(jack_client_t* ext_client);
  604. static jack_get_xrun_delayed_usecs_fun_def jack_get_xrun_delayed_usecs_fun = 0;
  605. EXPORT float jack_get_xrun_delayed_usecs(jack_client_t* ext_client)
  606. {
  607. return (*jack_get_xrun_delayed_usecs_fun)(ext_client);
  608. }
  609. typedef void (*jack_reset_max_delayed_usecs_fun_def)(jack_client_t* ext_client);
  610. static jack_reset_max_delayed_usecs_fun_def jack_reset_max_delayed_usecs_fun = 0;
  611. EXPORT void jack_reset_max_delayed_usecs(jack_client_t* ext_client)
  612. {
  613. (*jack_reset_max_delayed_usecs)(ext_client);
  614. }
  615. // thread.h
  616. typedef int (*jack_acquire_real_time_scheduling_fun_def)(pthread_t thread, int priority);
  617. static jack_acquire_real_time_scheduling_fun_def jack_acquire_real_time_scheduling_fun = 0;
  618. EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority)
  619. {
  620. return (*jack_acquire_real_time_scheduling_fun)(thread, priority);
  621. }
  622. typedef void *(*start_routine)(void*);
  623. typedef int (*jack_client_create_thread_fun_def)(jack_client_t* client,
  624. pthread_t *thread,
  625. int priority,
  626. int realtime, // boolean
  627. start_routine callback,
  628. void *arg);
  629. static jack_client_create_thread_fun_def jack_client_create_thread_fun = 0;
  630. EXPORT int jack_client_create_thread(jack_client_t* client,
  631. pthread_t *thread,
  632. int priority,
  633. int realtime, // boolean
  634. start_routine callback,
  635. void *arg)
  636. {
  637. return (*jack_client_create_thread_fun)(client, thread, priority, realtime, callback, arg);
  638. }
  639. typedef int (*jack_drop_real_time_scheduling_fun_def)(pthread_t thread);
  640. static jack_drop_real_time_scheduling_fun_def jack_drop_real_time_scheduling_fun = 0;
  641. EXPORT int jack_drop_real_time_scheduling(pthread_t thread)
  642. {
  643. return (*jack_drop_real_time_scheduling_fun)(thread);
  644. }
  645. // intclient.h
  646. typedef char* (*jack_get_internal_client_name_fun_def)(jack_client_t* ext_client, jack_intclient_t intclient);
  647. static jack_get_internal_client_name_fun_def jack_get_internal_client_name_fun = 0;
  648. EXPORT char* jack_get_internal_client_name(jack_client_t* ext_client, jack_intclient_t intclient)
  649. {
  650. return (*jack_get_internal_client_name_fun)(ext_client, intclient);
  651. }
  652. typedef jack_intclient_t (*jack_internal_client_handle_fun_def)(jack_client_t* ext_client, const char* client_name, jack_status_t* status);
  653. static jack_internal_client_handle_fun_def jack_internal_client_handle_fun = 0;
  654. EXPORT jack_intclient_t jack_internal_client_handle(jack_client_t* ext_client, const char* client_name, jack_status_t* status)
  655. {
  656. return (*jack_internal_client_handle_fun)(ext_client, client_name, status);
  657. }
  658. typedef jack_intclient_t (*jack_internal_client_load_fun_def)(jack_client_t* ext_client, const char* client_name, jack_options_t options, jack_status_t* status, ...);
  659. static jack_internal_client_load_fun_def jack_internal_client_load_fun = 0;
  660. EXPORT jack_intclient_t jack_internal_client_load(jack_client_t* ext_client, const char* client_name, jack_options_t options, jack_status_t* status, ...)
  661. {
  662. va_list ap;
  663. va_start(ap, status);
  664. jack_intclient_t res = (*jack_internal_client_load_fun)(ext_client, client_name, options, status, ap);
  665. va_end(ap);
  666. return res;
  667. }
  668. typedef jack_status_t (*jack_internal_client_unload_fun_def)(jack_client_t* ext_client, jack_intclient_t intclient);
  669. static jack_internal_client_unload_fun_def jack_internal_client_unload_fun = 0;
  670. EXPORT jack_status_t jack_internal_client_unload(jack_client_t* ext_client, jack_intclient_t intclient)
  671. {
  672. return (*jack_internal_client_unload_fun)(ext_client, intclient);
  673. }
  674. // client
  675. static long gClientCount = 0;
  676. static void* gLibrary = 0;
  677. static bool init_library();
  678. static bool open_library();
  679. static void close_library();
  680. typedef jack_client_t * (*jack_client_open_fun_def)(const char *client_name, jack_options_t options, jack_status_t *status, ...);
  681. static jack_client_open_fun_def jack_client_open_fun = 0;
  682. EXPORT jack_client_t * jack_client_open(const char *client_name, jack_options_t options, jack_status_t *status, ...)
  683. {
  684. // Library check...
  685. if (!open_library())
  686. return 0;
  687. va_list ap;
  688. va_start(ap, status);
  689. jack_client_t* res = (*jack_client_open_fun)(client_name, options, status, ap);
  690. va_end(ap);
  691. return res;
  692. }
  693. typedef jack_client_t * (*jack_client_new_fun_def)(const char *client_name);
  694. static jack_client_new_fun_def jack_client_new_fun = 0;
  695. EXPORT jack_client_t * jack_client_new(const char *client_name)
  696. {
  697. // Library check...
  698. if (!open_library())
  699. return 0;
  700. return (*jack_client_new_fun)(client_name);
  701. }
  702. typedef int (*jack_client_close_fun_def)(jack_client_t *client);
  703. static jack_client_close_fun_def jack_client_close_fun = 0;
  704. EXPORT int jack_client_close(jack_client_t *client)
  705. {
  706. int res = (*jack_client_close_fun)(client);
  707. close_library();
  708. return res;
  709. }
  710. // Library loader
  711. static bool get_jack_library_in_directory(char* dir_name, char* library_name)
  712. {
  713. struct dirent * dir_entry;
  714. DIR * dir_stream = opendir(dir_name);
  715. if (!dir_stream)
  716. return false;
  717. while ((dir_entry = readdir(dir_stream))) {
  718. if (strncmp("libjack.so", dir_entry->d_name, 10) == 0) {
  719. strcpy(library_name, dir_entry->d_name);
  720. closedir(dir_stream);
  721. return true;
  722. }
  723. }
  724. closedir(dir_stream);
  725. return false;
  726. }
  727. static bool get_jack_library(char* library_name)
  728. {
  729. if (get_jack_library_in_directory("/usr/lib", library_name))
  730. return true;
  731. if (get_jack_library_in_directory("/usr/local/lib", library_name))
  732. return true;
  733. return false;
  734. }
  735. static bool open_library()
  736. {
  737. if (gClientCount++ == 0) {
  738. return init_library();
  739. } else {
  740. return true;
  741. }
  742. }
  743. static void close_library()
  744. {
  745. if (--gClientCount == 0) {
  746. dlclose(gLibrary);
  747. }
  748. }
  749. static bool check_client(void* library)
  750. {
  751. jack_client_t* client = 0;
  752. // Get "new", "open" and "close" entry points...
  753. jack_client_new_fun = (jack_client_new_fun_def)dlsym(library, "jack_client_new");
  754. jack_client_close_fun = (jack_client_close_fun_def)dlsym(library, "jack_client_close");
  755. jack_client_open_fun = (jack_client_open_fun_def)dlsym(gLibrary, "jack_client_open");
  756. // Try opening a client...
  757. if ((client = (*jack_client_new_fun)("dummy"))) { // jackd server is running....
  758. (*jack_client_close_fun)(client);
  759. return true;
  760. } else {
  761. return false;
  762. }
  763. }
  764. static bool init_library()
  765. {
  766. char library_name[64];
  767. void* jackLibrary = (get_jack_library(library_name)) ? dlopen(library_name, RTLD_LAZY) : 0;
  768. void* jackmpLibrary = dlopen("libjackmp.so", RTLD_LAZY);
  769. if (jackLibrary) {
  770. if (check_client(jackLibrary)) { // jackd is running...
  771. gLibrary = jackLibrary;
  772. if (jackmpLibrary) dlclose(jackmpLibrary);
  773. } else if (check_client(jackmpLibrary)) { // jackdmp is running...
  774. gLibrary = jackmpLibrary;
  775. if (jackLibrary) dlclose(jackLibrary);
  776. } else {
  777. goto error;
  778. }
  779. } else if (jackmpLibrary) {
  780. if (check_client(jackmpLibrary)) { // jackd is running...
  781. gLibrary = jackmpLibrary;
  782. } else {
  783. goto error;
  784. }
  785. } else {
  786. printf("Jack libraries not found, failure...\n");
  787. goto error;
  788. }
  789. // Load entry points...
  790. jack_port_get_buffer_fun = (jack_port_get_buffer_fun_def)dlsym(gLibrary, "jack_port_get_buffer");
  791. jack_port_name_fun = (jack_port_name_fun_def)dlsym(gLibrary, "jack_port_name");
  792. jack_port_short_name_fun = (jack_port_short_name_fun_def)dlsym(gLibrary, "jack_port_short_name");
  793. jack_port_flags_fun = (jack_port_flags_fun_def)dlsym(gLibrary, "jack_port_flags");
  794. jack_port_type_fun = (jack_port_type_fun_def)dlsym(gLibrary, "jack_port_type");
  795. jack_port_connected_fun = (jack_port_connected_fun_def)dlsym(gLibrary, "jack_port_connected");
  796. jack_port_connected_to_fun = (jack_port_connected_to_fun_def)dlsym(gLibrary, "jack_port_connected_to");
  797. jack_port_tie_fun = (jack_port_tie_fun_def)dlsym(gLibrary, "jack_port_tie");
  798. jack_port_untie_fun = (jack_port_untie_fun_def)dlsym(gLibrary, "jack_port_untie");
  799. jack_port_get_latency_fun = (jack_port_get_latency_fun_def)dlsym(gLibrary, "jack_port_get_latency");
  800. jack_port_set_latency_fun = (jack_port_set_latency_fun_def)dlsym(gLibrary, "jack_port_set_latency");
  801. jack_recompute_total_latencies_fun = (jack_recompute_total_latencies_fun_def)dlsym(gLibrary, "jack_recompute_total_latencies");
  802. jack_port_set_name_fun = (jack_port_set_name_fun_def)dlsym(gLibrary, "jack_port_set_name");
  803. jack_port_request_monitor_fun = (jack_port_request_monitor_fun_def)dlsym(gLibrary, "jack_port_request_monitor");
  804. jack_port_request_monitor_by_name_fun = (jack_port_request_monitor_by_name_fun_def)dlsym(gLibrary, "jack_port_request_monitor_by_name");
  805. jack_port_ensure_monitor_fun = (jack_port_ensure_monitor_fun_def)dlsym(gLibrary, "jack_port_ensure_monitor");
  806. jack_port_monitoring_input_fun = (jack_port_monitoring_input_fun_def)dlsym(gLibrary, "jack_port_monitoring_input_fun");
  807. jack_is_realtime_fun = (jack_is_realtime_fun_def)dlsym(gLibrary, "jack_is_realtime");
  808. jack_on_shutdown_fun = (jack_on_shutdown_fun_def)dlsym(gLibrary, "jack_on_shutdown");
  809. jack_set_process_callback_fun = (jack_set_process_callback_fun_def)dlsym(gLibrary, "jack_set_process_callback");
  810. jack_set_freewheel_callback_fun = (jack_set_freewheel_callback_fun_def)dlsym(gLibrary, "jack_set_freewheel_callback");
  811. jack_set_freewheel_fun = (jack_set_freewheel_fun_def)dlsym(gLibrary, "jack_set_freewheel");
  812. jack_set_buffer_size_fun = (jack_set_buffer_size_fun_def)dlsym(gLibrary, "jack_set_buffer_size");
  813. jack_set_buffer_size_callback_fun = (jack_set_buffer_size_callback_fun_def)dlsym(gLibrary, "jack_set_buffer_size_callback");
  814. jack_set_sample_rate_callback_fun = (jack_set_sample_rate_callback_fun_def)dlsym(gLibrary, "jack_set_sample_rate_callback");
  815. jack_set_port_registration_callback_fun = (jack_set_port_registration_callback_fun_def)dlsym(gLibrary, "jack_set_port_registration_callback");
  816. jack_set_graph_order_callback_fun = (jack_set_graph_order_callback_fun_def)dlsym(gLibrary, "jack_set_graph_order_callback");
  817. jack_set_xrun_callback_fun = (jack_set_xrun_callback_fun_def)dlsym(gLibrary, "jack_set_xrun_callback");
  818. jack_set_thread_init_callback_fun = (jack_set_thread_init_callback_fun_def)dlsym(gLibrary, "jack_set_thread_init_callback");
  819. jack_activate_fun = (jack_activate_fun_def)dlsym(gLibrary, "jack_activate");
  820. jack_deactivate_fun = (jack_deactivate_fun_def)dlsym(gLibrary, "jack_deactivate");
  821. jack_port_register_fun = (jack_port_register_fun_def)dlsym(gLibrary, "jack_port_register");
  822. jack_port_unregister_fun = (jack_port_unregister_fun_def)dlsym(gLibrary, "jack_port_unregister");
  823. jack_port_is_mine_fun = (jack_port_is_mine_fun_def)dlsym(gLibrary, "jack_port_is_mine");
  824. jack_port_get_connections_fun = (jack_port_get_connections_fun_def)dlsym(gLibrary, "jack_port_get_connections");
  825. jack_port_get_all_connections_fun = (jack_port_get_all_connections_fun_def)dlsym(gLibrary, "jack_port_get_all_connections_fun");
  826. jack_port_lock_fun = (jack_port_lock_fun_def)dlsym(gLibrary, "jack_port_lock");
  827. jack_port_unlock_fun = (jack_port_unlock_fun_def)dlsym(gLibrary, "jack_port_unlock");
  828. jack_port_get_total_latency_fun = (jack_port_get_total_latency_fun_def)dlsym(gLibrary, "jack_port_get_total_latency");
  829. jack_connect_fun = (jack_connect_fun_def)dlsym(gLibrary, "jack_connect");
  830. jack_disconnect_fun = (jack_disconnect_fun_def)dlsym(gLibrary, "jack_disconnect");
  831. jack_port_connect_fun = (jack_port_connect_fun_def)dlsym(gLibrary, "jack_port_connect");
  832. jack_port_disconnect_fun = (jack_port_disconnect_fun_def)dlsym(gLibrary, "jack_port_disconnect");
  833. jack_get_sample_rate_fun = (jack_get_sample_rate_fun_def)dlsym(gLibrary, "jack_get_sample_rate");
  834. jack_get_buffer_size_fun = (jack_get_buffer_size_fun_def)dlsym(gLibrary, "jack_get_buffer_size");
  835. jack_get_ports_fun = (jack_get_ports_fun_def)dlsym(gLibrary, "jack_get_ports");
  836. jack_port_by_name_fun = (jack_port_by_name_fun_def)dlsym(gLibrary, "jack_port_by_name");
  837. jack_port_by_id_fun = (jack_port_by_id_fun_def)dlsym(gLibrary, "jack_port_by_id");
  838. jack_engine_takeover_timebase_fun = (jack_engine_takeover_timebase_fun_def)dlsym(gLibrary, "jack_engine_takeover_timebase");
  839. jack_frames_since_cycle_start_fun = (jack_frames_since_cycle_start_fun_def)dlsym(gLibrary, "jack_frames_since_cycle_start");
  840. jack_frame_time_fun = (jack_frame_time_fun_def)dlsym(gLibrary, "jack_frame_time_fun");
  841. jack_last_frame_time_fun = (jack_last_frame_time_fun_def)dlsym(gLibrary, "jack_last_frame_time");
  842. jack_cpu_load_fun = (jack_cpu_load_fun_def)dlsym(gLibrary, "jack_cpu_load");
  843. jack_client_thread_id_fun = (jack_client_thread_id_fun_def)dlsym(gLibrary, "jack_client_thread_id");
  844. jack_get_client_name_fun = (jack_get_client_name_fun_def)dlsym(gLibrary, "jack_get_client_name");
  845. jack_port_name_size_fun = (jack_port_name_size_fun_def)dlsym(gLibrary, "jack_port_name_size");
  846. jack_client_name_size_fun = (jack_client_name_size_fun_def)dlsym(gLibrary, "jack_client_name_size");
  847. jack_release_timebase_fun = (jack_release_timebase_fun_def)dlsym(gLibrary, "jack_release_timebase");
  848. jack_set_sync_callback_fun = (jack_set_sync_callback_fun_def)dlsym(gLibrary, "jack_set_sync_callback");
  849. jack_set_sync_timeout_fun = (jack_set_sync_timeout_fun_def)dlsym(gLibrary, "jack_set_sync_timeout");
  850. jack_set_timebase_callback_fun = (jack_set_timebase_callback_fun_def)dlsym(gLibrary, "jack_set_timebase_callback");
  851. jack_transport_locate_fun = (jack_transport_locate_fun_def)dlsym(gLibrary, "jack_transport_locate_fun");
  852. jack_transport_query_fun = (jack_transport_query_fun_def)dlsym(gLibrary, "jack_transport_query");
  853. jack_get_current_transport_frame_fun = (jack_get_current_transport_frame_fun_def)dlsym(gLibrary, "jack_get_current_transport_frame");
  854. jack_transport_reposition_fun = (jack_transport_reposition_fun_def)dlsym(gLibrary, "jack_transport_reposition");
  855. jack_transport_start_fun = (jack_transport_start_fun_def)dlsym(gLibrary, "jack_transport_start");
  856. jack_transport_stop_fun = (jack_transport_stop_fun_def)dlsym(gLibrary, "jack_transport_stop");
  857. jack_get_transport_info_fun = (jack_get_transport_info_fun_def)dlsym(gLibrary, "jack_get_transport_info");
  858. jack_set_transport_info_fun = (jack_set_transport_info_fun_def)dlsym(gLibrary, "jack_set_transport_info");
  859. jack_get_max_delayed_usecs_fun = (jack_get_max_delayed_usecs_fun_def)dlsym(gLibrary, "jack_get_max_delayed_usecs");
  860. jack_get_xrun_delayed_usecs_fun = (jack_get_xrun_delayed_usecs_fun_def)dlsym(gLibrary, "jack_get_xrun_delayed_usecs");
  861. jack_reset_max_delayed_usecs_fun = (jack_reset_max_delayed_usecs_fun_def)dlsym(gLibrary, "jack_reset_max_delayed_usecs");
  862. jack_acquire_real_time_scheduling_fun = (jack_acquire_real_time_scheduling_fun_def)dlsym(gLibrary, "jack_acquire_real_time_scheduling");
  863. jack_client_create_thread_fun = (jack_client_create_thread_fun_def)dlsym(gLibrary, "jack_client_create_thread");
  864. jack_drop_real_time_scheduling_fun = (jack_drop_real_time_scheduling_fun_def)dlsym(gLibrary, "jack_drop_real_time_scheduling");
  865. jack_get_internal_client_name_fun = (jack_get_internal_client_name_fun_def)dlsym(gLibrary, "jack_get_internal_client_name");
  866. jack_internal_client_handle_fun = (jack_internal_client_handle_fun_def)dlsym(gLibrary, "jack_internal_client_handle");
  867. jack_internal_client_load_fun = (jack_internal_client_load_fun_def)dlsym(gLibrary, "jack_internal_client_load");
  868. jack_internal_client_unload_fun = (jack_internal_client_unload_fun_def)dlsym(gLibrary, "jack_internal_client_unload");
  869. jack_client_open_fun = (jack_client_open_fun_def)dlsym(gLibrary, "jack_client_open");
  870. jack_client_new_fun = (jack_client_new_fun_def)dlsym(gLibrary, "jack_client_new");
  871. jack_client_close_fun = (jack_client_close_fun_def)dlsym(gLibrary, "jack_client_close");
  872. return true;
  873. error:
  874. if (jackLibrary) dlclose(jackLibrary);
  875. if (jackmpLibrary) dlclose(jackmpLibrary);
  876. return false;
  877. }