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.

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