Audio plugin host https://kx.studio/carla
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.

JackBridge1.cpp 52KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584
  1. /*
  2. * JackBridge (Part 1, JACK functions)
  3. * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include "JackBridge.hpp"
  17. #if ! (defined(JACKBRIDGE_DIRECT) || defined(JACKBRIDGE_DUMMY))
  18. #include "CarlaLibUtils.hpp"
  19. // -----------------------------------------------------------------------------
  20. typedef void (*jacksym_get_version)(int*, int*, int*, int*);
  21. typedef const char* (*jacksym_get_version_string)();
  22. typedef jack_client_t* (*jacksym_client_open)(const char*, jack_options_t, jack_status_t*, ...);
  23. typedef const char* (*jacksym_client_rename)(jack_client_t* client, const char* new_name);
  24. typedef int (*jacksym_client_close)(jack_client_t*);
  25. typedef int (*jacksym_client_name_size)();
  26. typedef char* (*jacksym_get_client_name)(jack_client_t*);
  27. typedef char* (*jacksym_get_uuid_for_client_name)(jack_client_t*, const char*);
  28. typedef char* (*jacksym_get_client_name_by_uuid)(jack_client_t*, const char*);
  29. typedef int (*jacksym_activate)(jack_client_t*);
  30. typedef int (*jacksym_deactivate)(jack_client_t*);
  31. typedef int (*jacksym_is_realtime)(jack_client_t*);
  32. typedef int (*jacksym_set_thread_init_callback)(jack_client_t*, JackThreadInitCallback, void*);
  33. typedef void (*jacksym_on_shutdown)(jack_client_t*, JackShutdownCallback, void*);
  34. typedef void (*jacksym_on_info_shutdown)(jack_client_t*, JackInfoShutdownCallback, void*);
  35. typedef int (*jacksym_set_process_callback)(jack_client_t*, JackProcessCallback, void*);
  36. typedef int (*jacksym_set_freewheel_callback)(jack_client_t*, JackFreewheelCallback, void*);
  37. typedef int (*jacksym_set_buffer_size_callback)(jack_client_t*, JackBufferSizeCallback, void*);
  38. typedef int (*jacksym_set_sample_rate_callback)(jack_client_t*, JackSampleRateCallback, void*);
  39. typedef int (*jacksym_set_client_registration_callback)(jack_client_t*, JackClientRegistrationCallback, void*);
  40. typedef int (*jacksym_set_port_registration_callback)(jack_client_t*, JackPortRegistrationCallback, void*);
  41. typedef int (*jacksym_set_port_rename_callback)(jack_client_t*, JackPortRenameCallback, void*);
  42. typedef int (*jacksym_set_port_connect_callback)(jack_client_t*, JackPortConnectCallback, void*);
  43. typedef int (*jacksym_set_graph_order_callback)(jack_client_t*, JackGraphOrderCallback, void*);
  44. typedef int (*jacksym_set_xrun_callback)(jack_client_t*, JackXRunCallback, void*);
  45. typedef int (*jacksym_set_latency_callback)(jack_client_t*, JackLatencyCallback, void*);
  46. typedef int (*jacksym_set_freewheel)(jack_client_t*, int);
  47. typedef int (*jacksym_set_buffer_size)(jack_client_t*, jack_nframes_t);
  48. typedef jack_nframes_t (*jacksym_get_sample_rate)(jack_client_t*);
  49. typedef jack_nframes_t (*jacksym_get_buffer_size)(jack_client_t*);
  50. typedef float (*jacksym_cpu_load)(jack_client_t*);
  51. typedef jack_port_t* (*jacksym_port_register)(jack_client_t*, const char*, const char*, unsigned long, unsigned long);
  52. typedef int (*jacksym_port_unregister)(jack_client_t*, jack_port_t*);
  53. typedef void* (*jacksym_port_get_buffer)(jack_port_t*, jack_nframes_t);
  54. typedef const char* (*jacksym_port_name)(const jack_port_t*);
  55. typedef jack_uuid_t (*jacksym_port_uuid)(const jack_port_t*);
  56. typedef const char* (*jacksym_port_short_name)(const jack_port_t*);
  57. typedef int (*jacksym_port_flags)(const jack_port_t*);
  58. typedef const char* (*jacksym_port_type)(const jack_port_t*);
  59. typedef int (*jacksym_port_is_mine)(const jack_client_t*, const jack_port_t*);
  60. typedef int (*jacksym_port_connected)(const jack_port_t*);
  61. typedef int (*jacksym_port_connected_to)(const jack_port_t*, const char*);
  62. typedef const char** (*jacksym_port_get_connections)(const jack_port_t*);
  63. typedef const char** (*jacksym_port_get_all_connections)(const jack_client_t*, const jack_port_t*);
  64. typedef int (*jacksym_port_set_name)(jack_port_t*, const char*);
  65. typedef int (*jacksym_port_set_alias)(jack_port_t*, const char*);
  66. typedef int (*jacksym_port_unset_alias)(jack_port_t*, const char*);
  67. typedef int (*jacksym_port_get_aliases)(const jack_port_t*, char* const aliases[2]);
  68. typedef int (*jacksym_port_request_monitor)(jack_port_t*, int);
  69. typedef int (*jacksym_port_request_monitor_by_name)(jack_client_t*, const char*, int);
  70. typedef int (*jacksym_port_ensure_monitor)(jack_port_t*, int);
  71. typedef int (*jacksym_port_monitoring_input)(jack_port_t*);
  72. typedef int (*jacksym_connect)(jack_client_t*, const char*, const char*);
  73. typedef int (*jacksym_disconnect)(jack_client_t*, const char*, const char*);
  74. typedef int (*jacksym_port_disconnect)(jack_client_t*, jack_port_t*);
  75. typedef int (*jacksym_port_name_size)();
  76. typedef int (*jacksym_port_type_size)();
  77. typedef size_t (*jacksym_port_type_get_buffer_size)(jack_client_t*, const char*);
  78. typedef void (*jacksym_port_get_latency_range)(jack_port_t*, jack_latency_callback_mode_t, jack_latency_range_t*);
  79. typedef void (*jacksym_port_set_latency_range)(jack_port_t*, jack_latency_callback_mode_t, jack_latency_range_t*);
  80. typedef int (*jacksym_recompute_total_latencies)(jack_client_t*);
  81. typedef const char** (*jacksym_get_ports)(jack_client_t*, const char*, const char*, unsigned long);
  82. typedef jack_port_t* (*jacksym_port_by_name)(jack_client_t*, const char*);
  83. typedef jack_port_t* (*jacksym_port_by_id)(jack_client_t*, jack_port_id_t);
  84. typedef void (*jacksym_free)(void*);
  85. typedef uint32_t (*jacksym_midi_get_event_count)(void*);
  86. typedef int (*jacksym_midi_event_get)(jack_midi_event_t*, void*, uint32_t);
  87. typedef void (*jacksym_midi_clear_buffer)(void*);
  88. typedef int (*jacksym_midi_event_write)(void*, jack_nframes_t, const jack_midi_data_t*, size_t);
  89. typedef jack_midi_data_t* (*jacksym_midi_event_reserve)(void*, jack_nframes_t, size_t);
  90. typedef int (*jacksym_release_timebase)(jack_client_t*);
  91. typedef int (*jacksym_set_sync_callback)(jack_client_t*, JackSyncCallback, void*);
  92. typedef int (*jacksym_set_sync_timeout)(jack_client_t*, jack_time_t);
  93. typedef int (*jacksym_set_timebase_callback)(jack_client_t*, int, JackTimebaseCallback, void*);
  94. typedef int (*jacksym_transport_locate)(jack_client_t*, jack_nframes_t);
  95. typedef jack_transport_state_t (*jacksym_transport_query)(const jack_client_t*, jack_position_t*);
  96. typedef jack_nframes_t (*jacksym_get_current_transport_frame)(const jack_client_t*);
  97. typedef int (*jacksym_transport_reposition)(jack_client_t*, const jack_position_t*);
  98. typedef void (*jacksym_transport_start)(jack_client_t*);
  99. typedef void (*jacksym_transport_stop)(jack_client_t*);
  100. typedef int (*jacksym_set_property)(jack_client_t*, jack_uuid_t, const char*, const char*, const char*);
  101. typedef int (*jacksym_get_property)(jack_uuid_t, const char*, char**, char**);
  102. typedef void (*jacksym_free_description)(jack_description_t*, int);
  103. typedef int (*jacksym_get_properties)(jack_uuid_t, jack_description_t*);
  104. typedef int (*jacksym_get_all_properties)(jack_description_t**);
  105. typedef int (*jacksym_remove_property)(jack_client_t*, jack_uuid_t, const char*);
  106. typedef int (*jacksym_remove_properties)(jack_client_t*, jack_uuid_t);
  107. typedef int (*jacksym_remove_all_properties)(jack_client_t*);
  108. typedef int (*jacksym_set_property_change_callback)(jack_client_t*, JackPropertyChangeCallback, void*);
  109. // -----------------------------------------------------------------------------
  110. struct JackBridge {
  111. void* lib;
  112. jacksym_get_version get_version_ptr;
  113. jacksym_get_version_string get_version_string_ptr;
  114. jacksym_client_open client_open_ptr;
  115. jacksym_client_rename client_rename_ptr;
  116. jacksym_client_close client_close_ptr;
  117. jacksym_client_name_size client_name_size_ptr;
  118. jacksym_get_client_name get_client_name_ptr;
  119. jacksym_get_uuid_for_client_name get_uuid_for_client_name_ptr;
  120. jacksym_get_client_name_by_uuid get_client_name_by_uuid_ptr;
  121. jacksym_activate activate_ptr;
  122. jacksym_deactivate deactivate_ptr;
  123. jacksym_is_realtime is_realtime_ptr;
  124. jacksym_set_thread_init_callback set_thread_init_callback_ptr;
  125. jacksym_on_shutdown on_shutdown_ptr;
  126. jacksym_on_info_shutdown on_info_shutdown_ptr;
  127. jacksym_set_process_callback set_process_callback_ptr;
  128. jacksym_set_freewheel_callback set_freewheel_callback_ptr;
  129. jacksym_set_buffer_size_callback set_buffer_size_callback_ptr;
  130. jacksym_set_sample_rate_callback set_sample_rate_callback_ptr;
  131. jacksym_set_client_registration_callback set_client_registration_callback_ptr;
  132. jacksym_set_port_registration_callback set_port_registration_callback_ptr;
  133. jacksym_set_port_rename_callback set_port_rename_callback_ptr;
  134. jacksym_set_port_connect_callback set_port_connect_callback_ptr;
  135. jacksym_set_xrun_callback set_xrun_callback_ptr;
  136. jacksym_set_latency_callback set_latency_callback_ptr;
  137. jacksym_set_freewheel set_freewheel_ptr;
  138. jacksym_set_buffer_size set_buffer_size_ptr;
  139. jacksym_get_sample_rate get_sample_rate_ptr;
  140. jacksym_get_buffer_size get_buffer_size_ptr;
  141. jacksym_cpu_load cpu_load_ptr;
  142. jacksym_port_register port_register_ptr;
  143. jacksym_port_unregister port_unregister_ptr;
  144. jacksym_port_get_buffer port_get_buffer_ptr;
  145. jacksym_port_name port_name_ptr;
  146. jacksym_port_uuid port_uuid_ptr;
  147. jacksym_port_short_name port_short_name_ptr;
  148. jacksym_port_flags port_flags_ptr;
  149. jacksym_port_type port_type_ptr;
  150. jacksym_port_is_mine port_is_mine_ptr;
  151. jacksym_port_connected port_connected_ptr;
  152. jacksym_port_connected_to port_connected_to_ptr;
  153. jacksym_port_get_connections port_get_connections_ptr;
  154. jacksym_port_get_all_connections port_get_all_connections_ptr;
  155. jacksym_port_set_name port_set_name_ptr;
  156. jacksym_port_set_alias port_set_alias_ptr;
  157. jacksym_port_unset_alias port_unset_alias_ptr;
  158. jacksym_port_get_aliases port_get_aliases_ptr;
  159. jacksym_port_request_monitor port_request_monitor_ptr;
  160. jacksym_port_request_monitor_by_name port_request_monitor_by_name_ptr;
  161. jacksym_port_ensure_monitor port_ensure_monitor_ptr;
  162. jacksym_port_monitoring_input port_monitoring_input_ptr;
  163. jacksym_connect connect_ptr;
  164. jacksym_disconnect disconnect_ptr;
  165. jacksym_port_disconnect port_disconnect_ptr;
  166. jacksym_port_name_size port_name_size_ptr;
  167. jacksym_port_type_size port_type_size_ptr;
  168. jacksym_port_type_get_buffer_size port_type_get_buffer_size_ptr;
  169. jacksym_port_get_latency_range port_get_latency_range_ptr;
  170. jacksym_port_set_latency_range port_set_latency_range_ptr;
  171. jacksym_recompute_total_latencies recompute_total_latencies_ptr;
  172. jacksym_get_ports get_ports_ptr;
  173. jacksym_port_by_name port_by_name_ptr;
  174. jacksym_port_by_id port_by_id_ptr;
  175. jacksym_free free_ptr;
  176. jacksym_midi_get_event_count midi_get_event_count_ptr;
  177. jacksym_midi_event_get midi_event_get_ptr;
  178. jacksym_midi_clear_buffer midi_clear_buffer_ptr;
  179. jacksym_midi_event_write midi_event_write_ptr;
  180. jacksym_midi_event_reserve midi_event_reserve_ptr;
  181. jacksym_release_timebase release_timebase_ptr;
  182. jacksym_set_sync_callback set_sync_callback_ptr;
  183. jacksym_set_sync_timeout set_sync_timeout_ptr;
  184. jacksym_set_timebase_callback set_timebase_callback_ptr;
  185. jacksym_transport_locate transport_locate_ptr;
  186. jacksym_transport_query transport_query_ptr;
  187. jacksym_get_current_transport_frame get_current_transport_frame_ptr;
  188. jacksym_transport_reposition transport_reposition_ptr;
  189. jacksym_transport_start transport_start_ptr;
  190. jacksym_transport_stop transport_stop_ptr;
  191. jacksym_set_property set_property_ptr;
  192. jacksym_get_property get_property_ptr;
  193. jacksym_free_description free_description_ptr;
  194. jacksym_get_properties get_properties_ptr;
  195. jacksym_get_all_properties get_all_properties_ptr;
  196. jacksym_remove_property remove_property_ptr;
  197. jacksym_remove_properties remove_properties_ptr;
  198. jacksym_remove_all_properties remove_all_properties_ptr;
  199. jacksym_set_property_change_callback set_property_change_callback_ptr;
  200. JackBridge()
  201. : lib(nullptr),
  202. get_version_ptr(nullptr),
  203. get_version_string_ptr(nullptr),
  204. client_open_ptr(nullptr),
  205. client_rename_ptr(nullptr),
  206. client_close_ptr(nullptr),
  207. client_name_size_ptr(nullptr),
  208. get_client_name_ptr(nullptr),
  209. get_uuid_for_client_name_ptr(nullptr),
  210. get_client_name_by_uuid_ptr(nullptr),
  211. activate_ptr(nullptr),
  212. deactivate_ptr(nullptr),
  213. is_realtime_ptr(nullptr),
  214. set_thread_init_callback_ptr(nullptr),
  215. on_shutdown_ptr(nullptr),
  216. on_info_shutdown_ptr(nullptr),
  217. set_process_callback_ptr(nullptr),
  218. set_freewheel_callback_ptr(nullptr),
  219. set_buffer_size_callback_ptr(nullptr),
  220. set_sample_rate_callback_ptr(nullptr),
  221. set_client_registration_callback_ptr(nullptr),
  222. set_port_registration_callback_ptr(nullptr),
  223. set_port_rename_callback_ptr(nullptr),
  224. set_port_connect_callback_ptr(nullptr),
  225. set_xrun_callback_ptr(nullptr),
  226. set_latency_callback_ptr(nullptr),
  227. set_freewheel_ptr(nullptr),
  228. set_buffer_size_ptr(nullptr),
  229. get_sample_rate_ptr(nullptr),
  230. get_buffer_size_ptr(nullptr),
  231. cpu_load_ptr(nullptr),
  232. port_register_ptr(nullptr),
  233. port_unregister_ptr(nullptr),
  234. port_get_buffer_ptr(nullptr),
  235. port_name_ptr(nullptr),
  236. port_uuid_ptr(nullptr),
  237. port_short_name_ptr(nullptr),
  238. port_flags_ptr(nullptr),
  239. port_type_ptr(nullptr),
  240. port_is_mine_ptr(nullptr),
  241. port_connected_ptr(nullptr),
  242. port_connected_to_ptr(nullptr),
  243. port_get_connections_ptr(nullptr),
  244. port_get_all_connections_ptr(nullptr),
  245. port_set_name_ptr(nullptr),
  246. port_set_alias_ptr(nullptr),
  247. port_unset_alias_ptr(nullptr),
  248. port_get_aliases_ptr(nullptr),
  249. port_request_monitor_ptr(nullptr),
  250. port_request_monitor_by_name_ptr(nullptr),
  251. port_ensure_monitor_ptr(nullptr),
  252. port_monitoring_input_ptr(nullptr),
  253. connect_ptr(nullptr),
  254. disconnect_ptr(nullptr),
  255. port_disconnect_ptr(nullptr),
  256. port_name_size_ptr(nullptr),
  257. port_type_size_ptr(nullptr),
  258. port_type_get_buffer_size_ptr(nullptr),
  259. port_get_latency_range_ptr(nullptr),
  260. port_set_latency_range_ptr(nullptr),
  261. recompute_total_latencies_ptr(nullptr),
  262. get_ports_ptr(nullptr),
  263. port_by_name_ptr(nullptr),
  264. port_by_id_ptr(nullptr),
  265. free_ptr(nullptr),
  266. midi_get_event_count_ptr(nullptr),
  267. midi_event_get_ptr(nullptr),
  268. midi_clear_buffer_ptr(nullptr),
  269. midi_event_write_ptr(nullptr),
  270. midi_event_reserve_ptr(nullptr),
  271. release_timebase_ptr(nullptr),
  272. set_sync_callback_ptr(nullptr),
  273. set_sync_timeout_ptr(nullptr),
  274. set_timebase_callback_ptr(nullptr),
  275. transport_locate_ptr(nullptr),
  276. transport_query_ptr(nullptr),
  277. get_current_transport_frame_ptr(nullptr),
  278. transport_reposition_ptr(nullptr),
  279. transport_start_ptr(nullptr),
  280. transport_stop_ptr(nullptr),
  281. set_property_ptr(nullptr),
  282. get_property_ptr(nullptr),
  283. free_description_ptr(nullptr),
  284. get_properties_ptr(nullptr),
  285. get_all_properties_ptr(nullptr),
  286. remove_property_ptr(nullptr),
  287. remove_properties_ptr(nullptr),
  288. remove_all_properties_ptr(nullptr),
  289. set_property_change_callback_ptr(nullptr)
  290. {
  291. # if defined(CARLA_OS_MAC)
  292. const char* const filename("libjack.dylib");
  293. # elif defined(CARLA_OS_WIN)
  294. const char* const filename("libjack.dll");
  295. # else
  296. const char* const filename("libjack.so.0");
  297. # endif
  298. lib = lib_open(filename);
  299. if (lib == nullptr)
  300. {
  301. fprintf(stderr, "Failed to load JACK DLL, reason:\n%s\n", lib_error(filename));
  302. return;
  303. }
  304. else
  305. {
  306. fprintf(stdout, "%s loaded sucessfully!\n", filename);
  307. }
  308. #define JOIN(a, b) a ## b
  309. #define LIB_SYMBOL(NAME) JOIN(NAME, _ptr) = (jacksym_##NAME)lib_symbol(lib, "jack_" #NAME);
  310. LIB_SYMBOL(get_version)
  311. LIB_SYMBOL(get_version_string)
  312. LIB_SYMBOL(client_open)
  313. LIB_SYMBOL(client_rename)
  314. LIB_SYMBOL(client_close)
  315. LIB_SYMBOL(client_name_size)
  316. LIB_SYMBOL(get_client_name)
  317. LIB_SYMBOL(get_uuid_for_client_name)
  318. LIB_SYMBOL(get_client_name_by_uuid)
  319. LIB_SYMBOL(activate)
  320. LIB_SYMBOL(deactivate)
  321. LIB_SYMBOL(is_realtime)
  322. LIB_SYMBOL(set_thread_init_callback)
  323. LIB_SYMBOL(on_shutdown)
  324. LIB_SYMBOL(on_info_shutdown)
  325. LIB_SYMBOL(set_process_callback)
  326. LIB_SYMBOL(set_freewheel_callback)
  327. LIB_SYMBOL(set_buffer_size_callback)
  328. LIB_SYMBOL(set_sample_rate_callback)
  329. LIB_SYMBOL(set_client_registration_callback)
  330. LIB_SYMBOL(set_port_registration_callback)
  331. LIB_SYMBOL(set_port_rename_callback)
  332. LIB_SYMBOL(set_port_connect_callback)
  333. LIB_SYMBOL(set_xrun_callback)
  334. LIB_SYMBOL(set_latency_callback)
  335. LIB_SYMBOL(set_freewheel)
  336. LIB_SYMBOL(set_buffer_size)
  337. LIB_SYMBOL(get_sample_rate)
  338. LIB_SYMBOL(get_buffer_size)
  339. LIB_SYMBOL(cpu_load)
  340. LIB_SYMBOL(port_register)
  341. LIB_SYMBOL(port_unregister)
  342. LIB_SYMBOL(port_get_buffer)
  343. LIB_SYMBOL(port_name)
  344. LIB_SYMBOL(port_uuid)
  345. LIB_SYMBOL(port_short_name)
  346. LIB_SYMBOL(port_flags)
  347. LIB_SYMBOL(port_type)
  348. LIB_SYMBOL(port_is_mine)
  349. LIB_SYMBOL(port_connected)
  350. LIB_SYMBOL(port_connected_to)
  351. LIB_SYMBOL(port_get_connections)
  352. LIB_SYMBOL(port_get_all_connections)
  353. LIB_SYMBOL(port_set_name)
  354. LIB_SYMBOL(port_set_alias)
  355. LIB_SYMBOL(port_unset_alias)
  356. LIB_SYMBOL(port_get_aliases)
  357. LIB_SYMBOL(port_request_monitor)
  358. LIB_SYMBOL(port_request_monitor_by_name)
  359. LIB_SYMBOL(port_ensure_monitor)
  360. LIB_SYMBOL(port_monitoring_input)
  361. LIB_SYMBOL(connect)
  362. LIB_SYMBOL(disconnect)
  363. LIB_SYMBOL(port_disconnect)
  364. LIB_SYMBOL(port_name_size)
  365. LIB_SYMBOL(port_type_size)
  366. LIB_SYMBOL(port_type_get_buffer_size)
  367. LIB_SYMBOL(port_get_latency_range)
  368. LIB_SYMBOL(port_set_latency_range)
  369. LIB_SYMBOL(recompute_total_latencies)
  370. LIB_SYMBOL(get_ports)
  371. LIB_SYMBOL(port_by_name)
  372. LIB_SYMBOL(port_by_id)
  373. LIB_SYMBOL(free)
  374. LIB_SYMBOL(midi_get_event_count)
  375. LIB_SYMBOL(midi_event_get)
  376. LIB_SYMBOL(midi_clear_buffer)
  377. LIB_SYMBOL(midi_event_write)
  378. LIB_SYMBOL(midi_event_reserve)
  379. LIB_SYMBOL(release_timebase)
  380. LIB_SYMBOL(set_sync_callback)
  381. LIB_SYMBOL(set_sync_timeout)
  382. LIB_SYMBOL(set_timebase_callback)
  383. LIB_SYMBOL(transport_locate)
  384. LIB_SYMBOL(transport_query)
  385. LIB_SYMBOL(get_current_transport_frame)
  386. LIB_SYMBOL(transport_reposition)
  387. LIB_SYMBOL(transport_start)
  388. LIB_SYMBOL(transport_stop)
  389. LIB_SYMBOL(set_property)
  390. LIB_SYMBOL(get_property)
  391. LIB_SYMBOL(free_description)
  392. LIB_SYMBOL(get_properties)
  393. LIB_SYMBOL(get_all_properties)
  394. LIB_SYMBOL(remove_property)
  395. LIB_SYMBOL(remove_properties)
  396. LIB_SYMBOL(remove_all_properties)
  397. LIB_SYMBOL(set_property_change_callback)
  398. #undef JOIN
  399. #undef LIB_SYMBOL
  400. }
  401. ~JackBridge()
  402. {
  403. if (lib != nullptr)
  404. {
  405. lib_close(lib);
  406. lib = nullptr;
  407. }
  408. }
  409. };
  410. static JackBridge bridge;
  411. #endif // ! JACKBRIDGE_DIRECT
  412. // -----------------------------------------------------------------------------
  413. void jackbridge_get_version(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto_ptr)
  414. {
  415. #if defined(JACKBRIDGE_DUMMY)
  416. #elif defined(JACKBRIDGE_DIRECT)
  417. return jack_get_version(major_ptr, minor_ptr, micro_ptr, proto_ptr);
  418. #else
  419. if (bridge.get_version_ptr != nullptr)
  420. return bridge.get_version_ptr(major_ptr, minor_ptr, micro_ptr, proto_ptr);
  421. #endif
  422. if (major_ptr != nullptr)
  423. *major_ptr = 0;
  424. if (minor_ptr != nullptr)
  425. *minor_ptr = 0;
  426. if (micro_ptr != nullptr)
  427. *micro_ptr = 0;
  428. if (proto_ptr != nullptr)
  429. *proto_ptr = 0;
  430. }
  431. const char* jackbridge_get_version_string()
  432. {
  433. #if defined(JACKBRIDGE_DUMMY)
  434. #elif defined(JACKBRIDGE_DIRECT)
  435. return jack_get_version_string();
  436. #else
  437. if (bridge.get_version_string_ptr != nullptr)
  438. return bridge.get_version_string_ptr();
  439. #endif
  440. return nullptr;
  441. }
  442. // -----------------------------------------------------------------------------
  443. jack_client_t* jackbridge_client_open(const char* client_name, jack_options_t options, jack_status_t* status, ...)
  444. {
  445. #if defined(JACKBRIDGE_DUMMY)
  446. #elif defined(JACKBRIDGE_DIRECT)
  447. return jack_client_open(client_name, options, status);
  448. #else
  449. if (bridge.client_open_ptr != nullptr)
  450. return bridge.client_open_ptr(client_name, options, status);
  451. #endif
  452. if (status != nullptr)
  453. *status = JackServerError;
  454. return nullptr;
  455. }
  456. bool jackbridge_client_close(jack_client_t* client)
  457. {
  458. #if defined(JACKBRIDGE_DUMMY)
  459. #elif defined(JACKBRIDGE_DIRECT)
  460. return (jack_client_close(client) == 0);
  461. #else
  462. if (bridge.client_close_ptr != nullptr)
  463. return (bridge.client_close_ptr(client) == 0);
  464. #endif
  465. return false;
  466. }
  467. // -----------------------------------------------------------------------------
  468. int jackbridge_client_name_size()
  469. {
  470. #if defined(JACKBRIDGE_DUMMY)
  471. #elif defined(JACKBRIDGE_DIRECT)
  472. return jack_client_name_size();
  473. #else
  474. if (bridge.client_name_size_ptr != nullptr)
  475. return bridge.client_name_size_ptr();
  476. #endif
  477. return 0;
  478. }
  479. char* jackbridge_get_client_name(jack_client_t* client)
  480. {
  481. #if defined(JACKBRIDGE_DUMMY)
  482. #elif defined(JACKBRIDGE_DIRECT)
  483. return jack_get_client_name(client);
  484. #else
  485. if (bridge.get_client_name_ptr != nullptr)
  486. return bridge.get_client_name_ptr(client);
  487. #endif
  488. return nullptr;
  489. }
  490. // -----------------------------------------------------------------------------
  491. char* jackbridge_get_uuid_for_client_name(jack_client_t* client, const char* name)
  492. {
  493. #if defined(JACKBRIDGE_DUMMY)
  494. #elif defined(JACKBRIDGE_DIRECT)
  495. return jack_get_uuid_for_client_name(client, name);
  496. #else
  497. if (bridge.get_uuid_for_client_name_ptr != nullptr)
  498. return bridge.get_uuid_for_client_name_ptr(client, name);
  499. #endif
  500. return nullptr;
  501. }
  502. char* jackbridge_get_client_name_by_uuid(jack_client_t* client, const char* uuid)
  503. {
  504. #if defined(JACKBRIDGE_DUMMY)
  505. #elif defined(JACKBRIDGE_DIRECT)
  506. return jack_get_client_name_by_uuid(client, uuid);
  507. #else
  508. if (bridge.get_client_name_by_uuid_ptr != nullptr)
  509. return bridge.get_client_name_by_uuid_ptr(client, uuid);
  510. #endif
  511. return nullptr;
  512. }
  513. // -----------------------------------------------------------------------------
  514. bool jackbridge_activate(jack_client_t* client)
  515. {
  516. #if defined(JACKBRIDGE_DUMMY)
  517. #elif defined(JACKBRIDGE_DIRECT)
  518. return (jack_activate(client) == 0);
  519. #else
  520. if (bridge.activate_ptr != nullptr)
  521. return (bridge.activate_ptr(client) == 0);
  522. #endif
  523. return false;
  524. }
  525. bool jackbridge_deactivate(jack_client_t* client)
  526. {
  527. #if defined(JACKBRIDGE_DUMMY)
  528. #elif defined(JACKBRIDGE_DIRECT)
  529. return (jack_deactivate(client) == 0);
  530. #else
  531. if (bridge.deactivate_ptr != nullptr)
  532. return (bridge.deactivate_ptr(client) == 0);
  533. #endif
  534. return false;
  535. }
  536. bool jackbridge_is_realtime(jack_client_t* client)
  537. {
  538. #if defined(JACKBRIDGE_DUMMY)
  539. #elif defined(JACKBRIDGE_DIRECT)
  540. return jack_is_realtime(client);
  541. #else
  542. if (bridge.is_realtime_ptr != nullptr)
  543. return bridge.is_realtime_ptr(client);
  544. #endif
  545. return false;
  546. }
  547. // -----------------------------------------------------------------------------
  548. bool jackbridge_set_thread_init_callback(jack_client_t* client, JackThreadInitCallback thread_init_callback, void* arg)
  549. {
  550. #if defined(JACKBRIDGE_DUMMY)
  551. #elif defined(JACKBRIDGE_DIRECT)
  552. return (jack_set_thread_init_callback(client, thread_init_callback, arg) == 0);
  553. #else
  554. if (bridge.set_thread_init_callback_ptr != nullptr)
  555. return (bridge.set_thread_init_callback_ptr(client, thread_init_callback, arg) == 0);
  556. #endif
  557. return false;
  558. }
  559. void jackbridge_on_shutdown(jack_client_t* client, JackShutdownCallback shutdown_callback, void* arg)
  560. {
  561. #if defined(JACKBRIDGE_DUMMY)
  562. #elif defined(JACKBRIDGE_DIRECT)
  563. jack_on_shutdown(client, shutdown_callback, arg);
  564. #else
  565. if (bridge.on_shutdown_ptr != nullptr)
  566. bridge.on_shutdown_ptr(client, shutdown_callback, arg);
  567. #endif
  568. }
  569. void jackbridge_on_info_shutdown(jack_client_t* client, JackInfoShutdownCallback shutdown_callback, void* arg)
  570. {
  571. #if defined(JACKBRIDGE_DUMMY)
  572. #elif defined(JACKBRIDGE_DIRECT)
  573. jack_on_info_shutdown(client, shutdown_callback, arg);
  574. #else
  575. if (bridge.on_info_shutdown_ptr != nullptr)
  576. bridge.on_info_shutdown_ptr(client, shutdown_callback, arg);
  577. #endif
  578. }
  579. bool jackbridge_set_process_callback(jack_client_t* client, JackProcessCallback process_callback, void* arg)
  580. {
  581. #if defined(JACKBRIDGE_DUMMY)
  582. #elif defined(JACKBRIDGE_DIRECT)
  583. return (jack_set_process_callback(client, process_callback, arg) == 0);
  584. #else
  585. if (bridge.set_process_callback_ptr != nullptr)
  586. return (bridge.set_process_callback_ptr(client, process_callback, arg) == 0);
  587. #endif
  588. return false;
  589. }
  590. bool jackbridge_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback freewheel_callback, void* arg)
  591. {
  592. #if defined(JACKBRIDGE_DUMMY)
  593. #elif defined(JACKBRIDGE_DIRECT)
  594. return (jack_set_freewheel_callback(client, freewheel_callback, arg) == 0);
  595. #else
  596. if (bridge.set_freewheel_callback_ptr != nullptr)
  597. return (bridge.set_freewheel_callback_ptr(client, freewheel_callback, arg) == 0);
  598. #endif
  599. return false;
  600. }
  601. bool jackbridge_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback bufsize_callback, void* arg)
  602. {
  603. #if defined(JACKBRIDGE_DUMMY)
  604. #elif defined(JACKBRIDGE_DIRECT)
  605. return (jack_set_buffer_size_callback(client, bufsize_callback, arg) == 0);
  606. #else
  607. if (bridge.set_buffer_size_callback_ptr != nullptr)
  608. return (bridge.set_buffer_size_callback_ptr(client, bufsize_callback, arg) == 0);
  609. #endif
  610. return false;
  611. }
  612. bool jackbridge_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback srate_callback, void* arg)
  613. {
  614. #if defined(JACKBRIDGE_DUMMY)
  615. #elif defined(JACKBRIDGE_DIRECT)
  616. return (jack_set_sample_rate_callback(client, srate_callback, arg) == 0);
  617. #else
  618. if (bridge.set_sample_rate_callback_ptr != nullptr)
  619. return (bridge.set_sample_rate_callback_ptr(client, srate_callback, arg) == 0);
  620. #endif
  621. return false;
  622. }
  623. bool jackbridge_set_client_registration_callback(jack_client_t* client, JackClientRegistrationCallback registration_callback, void* arg)
  624. {
  625. #if defined(JACKBRIDGE_DUMMY)
  626. #elif defined(JACKBRIDGE_DIRECT)
  627. return (jack_set_client_registration_callback(client, registration_callback, arg) == 0);
  628. #else
  629. if (bridge.set_client_registration_callback_ptr != nullptr)
  630. return (bridge.set_client_registration_callback_ptr(client, registration_callback, arg) == 0);
  631. #endif
  632. return false;
  633. }
  634. bool jackbridge_set_port_registration_callback(jack_client_t* client, JackPortRegistrationCallback registration_callback, void *arg)
  635. {
  636. #if defined(JACKBRIDGE_DUMMY)
  637. #elif defined(JACKBRIDGE_DIRECT)
  638. return (jack_set_port_registration_callback(client, registration_callback, arg) == 0);
  639. #else
  640. if (bridge.set_port_registration_callback_ptr != nullptr)
  641. return (bridge.set_port_registration_callback_ptr(client, registration_callback, arg) == 0);
  642. #endif
  643. return false;
  644. }
  645. bool jackbridge_set_port_rename_callback(jack_client_t* client, JackPortRenameCallback rename_callback, void* arg)
  646. {
  647. #if defined(JACKBRIDGE_DUMMY)
  648. #elif defined(JACKBRIDGE_DIRECT)
  649. return (jack_set_port_rename_callback(client, rename_callback, arg) == 0);
  650. #else
  651. if (bridge.set_port_rename_callback_ptr != nullptr)
  652. return (bridge.set_port_rename_callback_ptr(client, rename_callback, arg) == 0);
  653. #endif
  654. return false;
  655. }
  656. bool jackbridge_set_port_connect_callback(jack_client_t* client, JackPortConnectCallback connect_callback, void* arg)
  657. {
  658. #if defined(JACKBRIDGE_DUMMY)
  659. #elif defined(JACKBRIDGE_DIRECT)
  660. return (jack_set_port_connect_callback(client, connect_callback, arg) == 0);
  661. #else
  662. if (bridge.set_port_connect_callback_ptr != nullptr)
  663. return (bridge.set_port_connect_callback_ptr(client, connect_callback, arg) == 0);
  664. #endif
  665. return false;
  666. }
  667. bool jackbridge_set_xrun_callback(jack_client_t* client, JackXRunCallback xrun_callback, void* arg)
  668. {
  669. #if defined(JACKBRIDGE_DUMMY)
  670. #elif defined(JACKBRIDGE_DIRECT)
  671. return (jack_set_xrun_callback(client, xrun_callback, arg) == 0);
  672. #else
  673. if (bridge.set_xrun_callback_ptr != nullptr)
  674. return (bridge.set_xrun_callback_ptr(client, xrun_callback, arg) == 0);
  675. #endif
  676. return false;
  677. }
  678. bool jackbridge_set_latency_callback(jack_client_t* client, JackLatencyCallback latency_callback, void* arg)
  679. {
  680. #if defined(JACKBRIDGE_DUMMY)
  681. #elif defined(JACKBRIDGE_DIRECT)
  682. return (jack_set_latency_callback(client, latency_callback, arg) == 0);
  683. #else
  684. if (bridge.set_latency_callback_ptr != nullptr)
  685. return (bridge.set_latency_callback_ptr(client, latency_callback, arg) == 0);
  686. #endif
  687. return false;
  688. }
  689. // -----------------------------------------------------------------------------
  690. bool jackbridge_set_freewheel(jack_client_t* client, bool onoff)
  691. {
  692. #if defined(JACKBRIDGE_DUMMY)
  693. #elif defined(JACKBRIDGE_DIRECT)
  694. return jack_set_freewheel(client, onoff);
  695. #else
  696. if (bridge.set_freewheel_ptr != nullptr)
  697. return bridge.set_freewheel_ptr(client, onoff);
  698. #endif
  699. return false;
  700. }
  701. bool jackbridge_set_buffer_size(jack_client_t* client, jack_nframes_t nframes)
  702. {
  703. #if defined(JACKBRIDGE_DUMMY)
  704. #elif defined(JACKBRIDGE_DIRECT)
  705. return jack_set_buffer_size(client, nframes);
  706. #else
  707. if (bridge.set_buffer_size_ptr != nullptr)
  708. return bridge.set_buffer_size_ptr(client, nframes);
  709. #endif
  710. return false;
  711. }
  712. // -----------------------------------------------------------------------------
  713. jack_nframes_t jackbridge_get_sample_rate(jack_client_t* client)
  714. {
  715. #if defined(JACKBRIDGE_DUMMY)
  716. #elif defined(JACKBRIDGE_DIRECT)
  717. return jack_get_sample_rate(client);
  718. #else
  719. if (bridge.get_sample_rate_ptr != nullptr)
  720. return bridge.get_sample_rate_ptr(client);
  721. #endif
  722. return 0;
  723. }
  724. jack_nframes_t jackbridge_get_buffer_size(jack_client_t* client)
  725. {
  726. #if defined(JACKBRIDGE_DUMMY)
  727. #elif defined(JACKBRIDGE_DIRECT)
  728. return jack_get_buffer_size(client);
  729. #else
  730. if (bridge.get_buffer_size_ptr != nullptr)
  731. return bridge.get_buffer_size_ptr(client);
  732. #endif
  733. return 0;
  734. }
  735. float jackbridge_cpu_load(jack_client_t* client)
  736. {
  737. #if defined(JACKBRIDGE_DUMMY)
  738. #elif defined(JACKBRIDGE_DIRECT)
  739. return jack_cpu_load(client);
  740. #else
  741. if (bridge.cpu_load_ptr != nullptr)
  742. return bridge.cpu_load_ptr(client);
  743. #endif
  744. return 0.0f;
  745. }
  746. // -----------------------------------------------------------------------------
  747. jack_port_t* jackbridge_port_register(jack_client_t* client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size)
  748. {
  749. #if defined(JACKBRIDGE_DUMMY)
  750. #elif defined(JACKBRIDGE_DIRECT)
  751. return jack_port_register(client, port_name, port_type, flags, buffer_size);
  752. #else
  753. if (bridge.port_register_ptr != nullptr)
  754. return bridge.port_register_ptr(client, port_name, port_type, flags, buffer_size);
  755. #endif
  756. return nullptr;
  757. }
  758. bool jackbridge_port_unregister(jack_client_t* client, jack_port_t* port)
  759. {
  760. #if defined(JACKBRIDGE_DUMMY)
  761. #elif defined(JACKBRIDGE_DIRECT)
  762. return (jack_port_unregister(client, port) == 0);
  763. #else
  764. if (bridge.port_unregister_ptr != nullptr)
  765. return (bridge.port_unregister_ptr(client, port) == 0);
  766. #endif
  767. return false;
  768. }
  769. void* jackbridge_port_get_buffer(jack_port_t* port, jack_nframes_t nframes)
  770. {
  771. #if defined(JACKBRIDGE_DUMMY)
  772. #elif defined(JACKBRIDGE_DIRECT)
  773. return jack_port_get_buffer(port, nframes);
  774. #else
  775. if (bridge.port_get_buffer_ptr != nullptr)
  776. return bridge.port_get_buffer_ptr(port, nframes);
  777. #endif
  778. return nullptr;
  779. }
  780. // -----------------------------------------------------------------------------
  781. const char* jackbridge_port_name(const jack_port_t* port)
  782. {
  783. #if defined(JACKBRIDGE_DUMMY)
  784. #elif defined(JACKBRIDGE_DIRECT)
  785. return jack_port_name(port);
  786. #else
  787. if (bridge.port_name_ptr != nullptr)
  788. return bridge.port_name_ptr(port);
  789. #endif
  790. return nullptr;
  791. }
  792. jack_uuid_t jackbridge_port_uuid(const jack_port_t* port)
  793. {
  794. #if defined(JACKBRIDGE_DUMMY)
  795. #elif defined(JACKBRIDGE_DIRECT)
  796. return jack_port_uuid(port);
  797. #else
  798. if (bridge.port_uuid_ptr != nullptr)
  799. return bridge.port_uuid_ptr(port);
  800. #endif
  801. return 0;
  802. }
  803. const char* jackbridge_port_short_name(const jack_port_t* port)
  804. {
  805. #if defined(JACKBRIDGE_DUMMY)
  806. #elif defined(JACKBRIDGE_DIRECT)
  807. return jack_port_short_name(port);
  808. #else
  809. if (bridge.port_short_name_ptr != nullptr)
  810. return bridge.port_short_name_ptr(port);
  811. #endif
  812. return nullptr;
  813. }
  814. int jackbridge_port_flags(const jack_port_t* port)
  815. {
  816. #if defined(JACKBRIDGE_DUMMY)
  817. #elif defined(JACKBRIDGE_DIRECT)
  818. return jack_port_flags(port);
  819. #else
  820. if (bridge.port_flags_ptr != nullptr)
  821. return bridge.port_flags_ptr(port);
  822. #endif
  823. return 0x0;
  824. }
  825. const char* jackbridge_port_type(const jack_port_t* port)
  826. {
  827. #if defined(JACKBRIDGE_DUMMY)
  828. #elif defined(JACKBRIDGE_DIRECT)
  829. return jack_port_type(port);
  830. #else
  831. if (bridge.port_type_ptr != nullptr)
  832. return bridge.port_type_ptr(port);
  833. #endif
  834. return nullptr;
  835. }
  836. bool jackbridge_port_is_mine(const jack_client_t* client, const jack_port_t* port)
  837. {
  838. #if defined(JACKBRIDGE_DUMMY)
  839. #elif defined(JACKBRIDGE_DIRECT)
  840. return jack_port_is_mine(client, port);
  841. #else
  842. if (bridge.port_is_mine_ptr != nullptr)
  843. return bridge.port_is_mine_ptr(client, port);
  844. #endif
  845. return false;
  846. }
  847. int jackbridge_port_connected(const jack_port_t* port)
  848. {
  849. #if defined(JACKBRIDGE_DUMMY)
  850. #elif defined(JACKBRIDGE_DIRECT)
  851. return jack_port_connected(port);
  852. #else
  853. if (bridge.port_connected_ptr != nullptr)
  854. return bridge.port_connected_ptr(port);
  855. #endif
  856. return 0;
  857. }
  858. bool jackbridge_port_connected_to(const jack_port_t* port, const char* port_name)
  859. {
  860. #if defined(JACKBRIDGE_DUMMY)
  861. #elif defined(JACKBRIDGE_DIRECT)
  862. return jack_port_connected_to(port, port_name);
  863. #else
  864. if (bridge.port_connected_to_ptr != nullptr)
  865. return bridge.port_connected_to_ptr(port, port_name);
  866. #endif
  867. return false;
  868. }
  869. const char** jackbridge_port_get_connections(const jack_port_t* port)
  870. {
  871. #if defined(JACKBRIDGE_DUMMY)
  872. #elif defined(JACKBRIDGE_DIRECT)
  873. return jack_port_get_connections(port);
  874. #else
  875. if (bridge.port_get_connections_ptr != nullptr)
  876. return bridge.port_get_connections_ptr(port);
  877. #endif
  878. return nullptr;
  879. }
  880. const char** jackbridge_port_get_all_connections(const jack_client_t* client, const jack_port_t* port)
  881. {
  882. #if defined(JACKBRIDGE_DUMMY)
  883. #elif defined(JACKBRIDGE_DIRECT)
  884. return jack_port_get_all_connections(client, port);
  885. #else
  886. if (bridge.port_get_all_connections_ptr != nullptr)
  887. return bridge.port_get_all_connections_ptr(client, port);
  888. #endif
  889. return nullptr;
  890. }
  891. // -----------------------------------------------------------------------------
  892. bool jackbridge_port_set_name(jack_port_t* port, const char* port_name)
  893. {
  894. #if defined(JACKBRIDGE_DUMMY)
  895. #elif defined(JACKBRIDGE_DIRECT)
  896. return (jack_port_set_name(port, port_name) == 0);
  897. #else
  898. if (bridge.port_set_name_ptr != nullptr)
  899. return (bridge.port_set_name_ptr(port, port_name) == 0);
  900. #endif
  901. return false;
  902. }
  903. bool jackbridge_port_set_alias(jack_port_t* port, const char* alias)
  904. {
  905. #if defined(JACKBRIDGE_DUMMY)
  906. #elif defined(JACKBRIDGE_DIRECT)
  907. return (jack_port_set_alias(port, alias) == 0);
  908. #else
  909. if (bridge.port_set_alias_ptr != nullptr)
  910. return (bridge.port_set_alias_ptr(port, alias) == 0);
  911. #endif
  912. return false;
  913. }
  914. bool jackbridge_port_unset_alias(jack_port_t* port, const char* alias)
  915. {
  916. #if defined(JACKBRIDGE_DUMMY)
  917. #elif defined(JACKBRIDGE_DIRECT)
  918. return (jack_port_unset_alias(port, alias) == 0);
  919. #else
  920. if (bridge.port_unset_alias_ptr != nullptr)
  921. return (bridge.port_unset_alias_ptr(port, alias) == 0);
  922. #endif
  923. return false;
  924. }
  925. int jackbridge_port_get_aliases(const jack_port_t* port, char* const aliases[2])
  926. {
  927. #if defined(JACKBRIDGE_DUMMY)
  928. #elif defined(JACKBRIDGE_DIRECT)
  929. return (jack_port_get_aliases(port, aliases) == 0);
  930. #else
  931. if (bridge.port_get_aliases_ptr != nullptr)
  932. return bridge.port_get_aliases_ptr(port, aliases);
  933. #endif
  934. return 0;
  935. }
  936. // -----------------------------------------------------------------------------
  937. bool jackbridge_port_request_monitor(jack_port_t* port, bool onoff)
  938. {
  939. #if defined(JACKBRIDGE_DUMMY)
  940. #elif defined(JACKBRIDGE_DIRECT)
  941. return (jack_port_request_monitor(port, onoff) == 0);
  942. #else
  943. if (bridge.port_request_monitor_ptr != nullptr)
  944. return (bridge.port_request_monitor_ptr(port, onoff) == 0);
  945. #endif
  946. return false;
  947. }
  948. bool jackbridge_port_request_monitor_by_name(jack_client_t* client, const char* port_name, bool onoff)
  949. {
  950. #if defined(JACKBRIDGE_DUMMY)
  951. #elif defined(JACKBRIDGE_DIRECT)
  952. return (jack_port_request_monitor_by_name(client, port_name, onoff) == 0);
  953. #else
  954. if (bridge.port_request_monitor_by_name_ptr != nullptr)
  955. return (bridge.port_request_monitor_by_name_ptr(client, port_name, onoff) == 0);
  956. #endif
  957. return false;
  958. }
  959. bool jackbridge_port_ensure_monitor(jack_port_t* port, bool onoff)
  960. {
  961. #if defined(JACKBRIDGE_DUMMY)
  962. #elif defined(JACKBRIDGE_DIRECT)
  963. return (jack_port_ensure_monitor(port, onoff) == 0);
  964. #else
  965. if (bridge.port_ensure_monitor_ptr != nullptr)
  966. return (bridge.port_ensure_monitor_ptr(port, onoff) == 0);
  967. #endif
  968. return false;
  969. }
  970. bool jackbridge_port_monitoring_input(jack_port_t* port)
  971. {
  972. #if defined(JACKBRIDGE_DUMMY)
  973. #elif defined(JACKBRIDGE_DIRECT)
  974. return jack_port_monitoring_input(port);
  975. #else
  976. if (bridge.port_monitoring_input_ptr != nullptr)
  977. return bridge.port_monitoring_input_ptr(port);
  978. #endif
  979. return false;
  980. }
  981. // -----------------------------------------------------------------------------
  982. bool jackbridge_connect(jack_client_t* client, const char* source_port, const char* destination_port)
  983. {
  984. #if defined(JACKBRIDGE_DUMMY)
  985. #elif defined(JACKBRIDGE_DIRECT)
  986. return (jack_connect(client, source_port, destination_port) == 0);
  987. #else
  988. if (bridge.connect_ptr != nullptr)
  989. return (bridge.connect_ptr(client, source_port, destination_port) == 0);
  990. #endif
  991. return false;
  992. }
  993. bool jackbridge_disconnect(jack_client_t* client, const char* source_port, const char* destination_port)
  994. {
  995. #if defined(JACKBRIDGE_DUMMY)
  996. #elif defined(JACKBRIDGE_DIRECT)
  997. return (jack_disconnect(client, source_port, destination_port) == 0);
  998. #else
  999. if (bridge.disconnect_ptr != nullptr)
  1000. return (bridge.disconnect_ptr(client, source_port, destination_port) == 0);
  1001. #endif
  1002. return false;
  1003. }
  1004. bool jackbridge_port_disconnect(jack_client_t* client, jack_port_t* port)
  1005. {
  1006. #if defined(JACKBRIDGE_DUMMY)
  1007. #elif defined(JACKBRIDGE_DIRECT)
  1008. return (jack_port_disconnect(client, port) == 0);
  1009. #else
  1010. if (bridge.port_disconnect_ptr != nullptr)
  1011. return (bridge.port_disconnect_ptr(client, port) == 0);
  1012. #endif
  1013. return false;
  1014. }
  1015. // -----------------------------------------------------------------------------
  1016. int jackbridge_port_name_size()
  1017. {
  1018. #if defined(JACKBRIDGE_DUMMY)
  1019. #elif defined(JACKBRIDGE_DIRECT)
  1020. return jack_port_name_size();
  1021. #else
  1022. if (bridge.port_name_size_ptr != nullptr)
  1023. return bridge.port_name_size_ptr();
  1024. #endif
  1025. return 0;
  1026. }
  1027. int jackbridge_port_type_size()
  1028. {
  1029. #if defined(JACKBRIDGE_DUMMY)
  1030. #elif defined(JACKBRIDGE_DIRECT)
  1031. return jack_port_type_size();
  1032. #else
  1033. if (bridge.port_type_size_ptr != nullptr)
  1034. return bridge.port_type_size_ptr();
  1035. #endif
  1036. return 0;
  1037. }
  1038. size_t jackbridge_port_type_get_buffer_size(jack_client_t* client, const char* port_type)
  1039. {
  1040. #if defined(JACKBRIDGE_DUMMY)
  1041. #elif defined(JACKBRIDGE_DIRECT)
  1042. return jack_port_type_get_buffer_size(client, port_type);
  1043. #else
  1044. if (bridge.port_type_get_buffer_size_ptr != nullptr)
  1045. return bridge.port_type_get_buffer_size_ptr(client, port_type);
  1046. #endif
  1047. return 0;
  1048. }
  1049. // -----------------------------------------------------------------------------
  1050. void jackbridge_port_get_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range)
  1051. {
  1052. #if defined(JACKBRIDGE_DUMMY)
  1053. #elif defined(JACKBRIDGE_DIRECT)
  1054. jack_port_get_latency_range(port, mode, range);
  1055. #else
  1056. if (bridge.port_get_latency_range_ptr != nullptr)
  1057. bridge.port_get_latency_range_ptr(port, mode, range);
  1058. #endif
  1059. }
  1060. void jackbridge_port_set_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range)
  1061. {
  1062. #if defined(JACKBRIDGE_DUMMY)
  1063. #elif defined(JACKBRIDGE_DIRECT)
  1064. jack_port_set_latency_range(port, mode, range);
  1065. #else
  1066. if (bridge.port_set_latency_range_ptr != nullptr)
  1067. bridge.port_set_latency_range_ptr(port, mode, range);
  1068. #endif
  1069. }
  1070. bool jackbridge_recompute_total_latencies(jack_client_t* client)
  1071. {
  1072. #if defined(JACKBRIDGE_DUMMY)
  1073. #elif defined(JACKBRIDGE_DIRECT)
  1074. return (jack_recompute_total_latencies(client) == 0);
  1075. #else
  1076. if (bridge.recompute_total_latencies_ptr != nullptr)
  1077. return (bridge.recompute_total_latencies_ptr(client) == 0);
  1078. #endif
  1079. return false;
  1080. }
  1081. // -----------------------------------------------------------------------------
  1082. const char** jackbridge_get_ports(jack_client_t* client, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags)
  1083. {
  1084. #if defined(JACKBRIDGE_DUMMY)
  1085. #elif defined(JACKBRIDGE_DIRECT)
  1086. return jack_get_ports(client, port_name_pattern, type_name_pattern, flags);
  1087. #else
  1088. if (bridge.get_ports_ptr != nullptr)
  1089. return bridge.get_ports_ptr(client, port_name_pattern, type_name_pattern, flags);
  1090. #endif
  1091. return nullptr;
  1092. }
  1093. jack_port_t* jackbridge_port_by_name(jack_client_t* client, const char* port_name)
  1094. {
  1095. #if defined(JACKBRIDGE_DUMMY)
  1096. #elif defined(JACKBRIDGE_DIRECT)
  1097. return jack_port_by_name(client, port_name);
  1098. #else
  1099. if (bridge.port_by_name_ptr != nullptr)
  1100. return bridge.port_by_name_ptr(client, port_name);
  1101. #endif
  1102. return nullptr;
  1103. }
  1104. jack_port_t* jackbridge_port_by_id(jack_client_t* client, jack_port_id_t port_id)
  1105. {
  1106. #if defined(JACKBRIDGE_DUMMY)
  1107. #elif defined(JACKBRIDGE_DIRECT)
  1108. return jack_port_by_id(client, port_id);
  1109. #else
  1110. if (bridge.port_by_id_ptr != nullptr)
  1111. return bridge.port_by_id_ptr(client, port_id);
  1112. #endif
  1113. return nullptr;
  1114. }
  1115. // -----------------------------------------------------------------------------
  1116. void jackbridge_free(void* ptr)
  1117. {
  1118. #if defined(JACKBRIDGE_DUMMY)
  1119. #elif defined(JACKBRIDGE_DIRECT)
  1120. return jack_free(ptr);
  1121. #else
  1122. if (bridge.free_ptr != nullptr)
  1123. return bridge.free_ptr(ptr);
  1124. // just in case
  1125. std::free(ptr);
  1126. #endif
  1127. }
  1128. // -----------------------------------------------------------------------------
  1129. uint32_t jackbridge_midi_get_event_count(void* port_buffer)
  1130. {
  1131. #if defined(JACKBRIDGE_DUMMY)
  1132. #elif defined(JACKBRIDGE_DIRECT)
  1133. return jack_midi_get_event_count(port_buffer);
  1134. #else
  1135. if (bridge.midi_get_event_count_ptr != nullptr)
  1136. return bridge.midi_get_event_count_ptr(port_buffer);
  1137. #endif
  1138. return 0;
  1139. }
  1140. bool jackbridge_midi_event_get(jack_midi_event_t* event, void* port_buffer, uint32_t event_index)
  1141. {
  1142. #if defined(JACKBRIDGE_DUMMY)
  1143. #elif defined(JACKBRIDGE_DIRECT)
  1144. return (jack_midi_event_get(event, port_buffer, event_index) == 0);
  1145. #else
  1146. if (bridge.midi_event_get_ptr != nullptr)
  1147. return (bridge.midi_event_get_ptr(event, port_buffer, event_index) == 0);
  1148. #endif
  1149. return false;
  1150. }
  1151. void jackbridge_midi_clear_buffer(void* port_buffer)
  1152. {
  1153. #if defined(JACKBRIDGE_DUMMY)
  1154. #elif defined(JACKBRIDGE_DIRECT)
  1155. jack_midi_clear_buffer(port_buffer);
  1156. #else
  1157. if (bridge.midi_clear_buffer_ptr != nullptr)
  1158. bridge.midi_clear_buffer_ptr(port_buffer);
  1159. #endif
  1160. }
  1161. bool jackbridge_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size)
  1162. {
  1163. #if defined(JACKBRIDGE_DUMMY)
  1164. #elif defined(JACKBRIDGE_DIRECT)
  1165. return (jack_midi_event_write(port_buffer, time, data, data_size) == 0);
  1166. #else
  1167. if (bridge.midi_event_write_ptr != nullptr)
  1168. return (bridge.midi_event_write_ptr(port_buffer, time, data, data_size) == 0);
  1169. #endif
  1170. return false;
  1171. }
  1172. jack_midi_data_t* jackbridge_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size)
  1173. {
  1174. #if defined(JACKBRIDGE_DUMMY)
  1175. #elif defined(JACKBRIDGE_DIRECT)
  1176. return jack_midi_event_reserve(port_buffer, time, data_size);
  1177. #else
  1178. if (bridge.midi_event_reserve_ptr != nullptr)
  1179. return bridge.midi_event_reserve_ptr(port_buffer, time, data_size);
  1180. #endif
  1181. return nullptr;
  1182. }
  1183. // -----------------------------------------------------------------------------
  1184. bool jackbridge_release_timebase(jack_client_t* client)
  1185. {
  1186. #if defined(JACKBRIDGE_DUMMY)
  1187. #elif defined(JACKBRIDGE_DIRECT)
  1188. return (jack_release_timebase(client) == 0);
  1189. #else
  1190. if (bridge.release_timebase_ptr != nullptr)
  1191. return (bridge.release_timebase_ptr(client) == 0);
  1192. #endif
  1193. return false;
  1194. }
  1195. bool jackbridge_set_sync_callback(jack_client_t* client, JackSyncCallback sync_callback, void* arg)
  1196. {
  1197. #if defined(JACKBRIDGE_DUMMY)
  1198. #elif defined(JACKBRIDGE_DIRECT)
  1199. return (jack_set_sync_callback(client, sync_callback, arg) == 0);
  1200. #else
  1201. if (bridge.set_sync_callback_ptr != nullptr)
  1202. return (bridge.set_sync_callback_ptr(client, sync_callback, arg) == 0);
  1203. #endif
  1204. return false;
  1205. }
  1206. bool jackbridge_set_sync_timeout(jack_client_t* client, jack_time_t timeout)
  1207. {
  1208. #if defined(JACKBRIDGE_DUMMY)
  1209. #elif defined(JACKBRIDGE_DIRECT)
  1210. return (jack_set_sync_timeout(client, timeout) == 0);
  1211. #else
  1212. if (bridge.set_sync_timeout_ptr != nullptr)
  1213. return (bridge.set_sync_timeout_ptr(client, timeout) == 0);
  1214. #endif
  1215. return false;
  1216. }
  1217. bool jackbridge_set_timebase_callback(jack_client_t* client, bool conditional, JackTimebaseCallback timebase_callback, void* arg)
  1218. {
  1219. #if defined(JACKBRIDGE_DUMMY)
  1220. #elif defined(JACKBRIDGE_DIRECT)
  1221. return (jack_set_timebase_callback(client, conditional, timebase_callback, arg) == 0);
  1222. #else
  1223. if (bridge.set_timebase_callback_ptr != nullptr)
  1224. return (bridge.set_timebase_callback_ptr(client, conditional, timebase_callback, arg) == 0);
  1225. #endif
  1226. return false;
  1227. }
  1228. bool jackbridge_transport_locate(jack_client_t* client, jack_nframes_t frame)
  1229. {
  1230. #if defined(JACKBRIDGE_DUMMY)
  1231. #elif defined(JACKBRIDGE_DIRECT)
  1232. return (jack_transport_locate(client, frame) == 0);
  1233. #else
  1234. if (bridge.transport_locate_ptr != nullptr)
  1235. return (bridge.transport_locate_ptr(client, frame) == 0);
  1236. #endif
  1237. return false;
  1238. }
  1239. jack_transport_state_t jackbridge_transport_query(const jack_client_t* client, jack_position_t* pos)
  1240. {
  1241. #if defined(JACKBRIDGE_DUMMY)
  1242. #elif defined(JACKBRIDGE_DIRECT)
  1243. return jack_transport_query(client, pos);
  1244. #else
  1245. if (bridge.transport_query_ptr != nullptr)
  1246. return bridge.transport_query_ptr(client, pos);
  1247. #endif
  1248. if (pos != nullptr)
  1249. {
  1250. // invalidate
  1251. pos->unique_1 = 0;
  1252. pos->unique_2 = 1;
  1253. }
  1254. return JackTransportStopped;
  1255. }
  1256. jack_nframes_t jackbridge_get_current_transport_frame(const jack_client_t* client)
  1257. {
  1258. #if defined(JACKBRIDGE_DUMMY)
  1259. #elif defined(JACKBRIDGE_DIRECT)
  1260. return jack_get_current_transport_frame(client);
  1261. #else
  1262. if (bridge.get_current_transport_frame_ptr != nullptr)
  1263. return bridge.get_current_transport_frame_ptr(client);
  1264. #endif
  1265. return 0;
  1266. }
  1267. bool jackbridge_transport_reposition(jack_client_t* client, const jack_position_t* pos)
  1268. {
  1269. #if defined(JACKBRIDGE_DUMMY)
  1270. #elif defined(JACKBRIDGE_DIRECT)
  1271. return (jack_transport_reposition(client, pos) == 0);
  1272. #else
  1273. if (bridge.transport_reposition_ptr != nullptr)
  1274. return (bridge.transport_reposition_ptr(client, pos) == 0);
  1275. #endif
  1276. return false;
  1277. }
  1278. void jackbridge_transport_start(jack_client_t* client)
  1279. {
  1280. #if defined(JACKBRIDGE_DUMMY)
  1281. #elif defined(JACKBRIDGE_DIRECT)
  1282. jack_transport_start(client);
  1283. #else
  1284. if (bridge.transport_start_ptr != nullptr)
  1285. bridge.transport_start_ptr(client);
  1286. #endif
  1287. }
  1288. void jackbridge_transport_stop(jack_client_t* client)
  1289. {
  1290. #if defined(JACKBRIDGE_DUMMY)
  1291. #elif defined(JACKBRIDGE_DIRECT)
  1292. jack_transport_stop(client);
  1293. #else
  1294. if (bridge.transport_stop_ptr != nullptr)
  1295. bridge.transport_stop_ptr(client);
  1296. #endif
  1297. }
  1298. // -----------------------------------------------------------------------------
  1299. bool jackbridge_set_property(jack_client_t* client, jack_uuid_t subject, const char* key, const char* value, const char* type)
  1300. {
  1301. #if defined(JACKBRIDGE_DUMMY)
  1302. #elif defined(JACKBRIDGE_DIRECT)
  1303. return (jack_set_property(client, subject, key, value, type) == 0);
  1304. #else
  1305. if (bridge.set_property_ptr != nullptr)
  1306. return (bridge.set_property_ptr(client, subject, key, value, type) == 0);
  1307. #endif
  1308. return false;
  1309. }
  1310. bool jackbridge_get_property(jack_uuid_t subject, const char* key, char** value, char** type)
  1311. {
  1312. #if defined(JACKBRIDGE_DUMMY)
  1313. #elif defined(JACKBRIDGE_DIRECT)
  1314. return (jack_get_property(subject, key, value, type) == 0);
  1315. #else
  1316. if (bridge.get_property_ptr != nullptr)
  1317. return (bridge.get_property_ptr(subject, key, value, type) == 0);
  1318. #endif
  1319. return false;
  1320. }
  1321. void jackbridge_free_description(jack_description_t* desc, bool free_description_itself)
  1322. {
  1323. #if defined(JACKBRIDGE_DUMMY)
  1324. #elif defined(JACKBRIDGE_DIRECT)
  1325. jack_free_description(desc, free_description_itself);
  1326. #else
  1327. if (bridge.free_description_ptr != nullptr)
  1328. bridge.free_description_ptr(desc, free_description_itself);
  1329. #endif
  1330. }
  1331. bool jackbridge_get_properties(jack_uuid_t subject, jack_description_t* desc)
  1332. {
  1333. #if defined(JACKBRIDGE_DUMMY)
  1334. #elif defined(JACKBRIDGE_DIRECT)
  1335. return (jack_get_properties(subject, desc) == 0);
  1336. #else
  1337. if (bridge.get_properties_ptr != nullptr)
  1338. return (bridge.get_properties_ptr(subject, desc) == 0);
  1339. #endif
  1340. return false;
  1341. }
  1342. bool jackbridge_get_all_properties(jack_description_t** descs)
  1343. {
  1344. #if defined(JACKBRIDGE_DUMMY)
  1345. #elif defined(JACKBRIDGE_DIRECT)
  1346. return (jack_get_all_properties(descs) == 0);
  1347. #else
  1348. if (bridge.get_all_properties_ptr != nullptr)
  1349. return (bridge.get_all_properties_ptr(descs) == 0);
  1350. #endif
  1351. return false;
  1352. }
  1353. bool jackbridge_remove_property(jack_client_t* client, jack_uuid_t subject, const char* key)
  1354. {
  1355. #if defined(JACKBRIDGE_DUMMY)
  1356. #elif defined(JACKBRIDGE_DIRECT)
  1357. return (jack_remove_property(client, subject, key) == 0);
  1358. #else
  1359. if (bridge.remove_property_ptr != nullptr)
  1360. return (bridge.remove_property_ptr(client, subject, key) == 0);
  1361. #endif
  1362. return false;
  1363. }
  1364. int jackbridge_remove_properties(jack_client_t* client, jack_uuid_t subject)
  1365. {
  1366. #if defined(JACKBRIDGE_DUMMY)
  1367. #elif defined(JACKBRIDGE_DIRECT)
  1368. return jack_remove_properties(client, subject);
  1369. #else
  1370. if (bridge.remove_properties_ptr != nullptr)
  1371. return bridge.remove_properties_ptr(client, subject);
  1372. #endif
  1373. return 0;
  1374. }
  1375. bool jackbridge_remove_all_properties(jack_client_t* client)
  1376. {
  1377. #if defined(JACKBRIDGE_DUMMY)
  1378. #elif defined(JACKBRIDGE_DIRECT)
  1379. return (jack_remove_all_properties(client) == 0);
  1380. #else
  1381. if (bridge.remove_all_properties_ptr != nullptr)
  1382. return (bridge.remove_all_properties_ptr(client) == 0);
  1383. #endif
  1384. return false;
  1385. }
  1386. bool jackbridge_set_property_change_callback(jack_client_t* client, JackPropertyChangeCallback callback, void* arg)
  1387. {
  1388. #if defined(JACKBRIDGE_DUMMY)
  1389. #elif defined(JACKBRIDGE_DIRECT)
  1390. return (jack_set_property_change_callback(client, callback, arg) == 0);
  1391. #else
  1392. if (bridge.set_property_change_callback_ptr != nullptr)
  1393. return (bridge.set_property_change_callback_ptr(client, callback, arg) == 0);
  1394. #endif
  1395. return false;
  1396. }
  1397. // -----------------------------------------------------------------------------