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.

978 lines
45KB

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