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.

jackbridge.c 6.0KB

12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. /*
  2. * JackBridge
  3. * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the COPYING file
  16. */
  17. #include "jackbridge.h"
  18. // -----------------------------------------------------------------------------
  19. jack_client_t* jackbridge_client_open(const char* client_name, jack_options_t options, jack_status_t* status, ...)
  20. {
  21. #ifndef JACKBRIDGE_DUMMY
  22. return jack_client_open(client_name, options, status);
  23. #else
  24. return NULL;
  25. #endif
  26. }
  27. int jackbridge_client_close(jack_client_t* client)
  28. {
  29. #ifndef JACKBRIDGE_DUMMY
  30. return jack_client_close(client);
  31. #else
  32. return 0;
  33. #endif
  34. }
  35. int jackbridge_client_name_size()
  36. {
  37. #ifndef JACKBRIDGE_DUMMY
  38. return jack_client_name_size();
  39. #else
  40. return 0;
  41. #endif
  42. }
  43. char* jackbridge_get_client_name(jack_client_t* client)
  44. {
  45. #ifndef JACKBRIDGE_DUMMY
  46. return jack_get_client_name(client);
  47. #else
  48. return NULL;
  49. #endif
  50. }
  51. int jackbridge_port_name_size()
  52. {
  53. #ifndef JACKBRIDGE_DUMMY
  54. return jack_port_name_size();
  55. #else
  56. return 0;
  57. #endif
  58. }
  59. int jackbridge_recompute_total_latencies(jack_client_t* client)
  60. {
  61. #ifndef JACKBRIDGE_DUMMY
  62. return jack_recompute_total_latencies(client);
  63. #else
  64. return 0;
  65. #endif
  66. }
  67. void jackbridge_port_get_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range)
  68. {
  69. #ifndef JACKBRIDGE_DUMMY
  70. jack_port_get_latency_range(port, mode, range);
  71. #endif
  72. }
  73. void jackbridge_port_set_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range)
  74. {
  75. #ifndef JACKBRIDGE_DUMMY
  76. jack_port_set_latency_range(port, mode, range);
  77. #endif
  78. }
  79. int jackbridge_activate(jack_client_t* client)
  80. {
  81. #ifndef JACKBRIDGE_DUMMY
  82. return jack_activate(client);
  83. #else
  84. return 0;
  85. #endif
  86. }
  87. int jackbridge_deactivate(jack_client_t* client)
  88. {
  89. #ifndef JACKBRIDGE_DUMMY
  90. return jack_deactivate(client);
  91. #else
  92. return 0;
  93. #endif
  94. }
  95. void jackbridge_on_shutdown(jack_client_t* client, JackShutdownCallback shutdown_callback, void* arg)
  96. {
  97. #ifndef JACKBRIDGE_DUMMY
  98. jack_on_shutdown(client, shutdown_callback, arg);
  99. #endif
  100. }
  101. int jackbridge_set_latency_callback(jack_client_t* client, JackLatencyCallback latency_callback, void* arg)
  102. {
  103. #ifndef JACKBRIDGE_DUMMY
  104. return jack_set_latency_callback(client, latency_callback, arg);
  105. #else
  106. return 0;
  107. #endif
  108. }
  109. int jackbridge_set_process_callback(jack_client_t* client, JackProcessCallback process_callback, void* arg)
  110. {
  111. #ifndef JACKBRIDGE_DUMMY
  112. return jack_set_process_callback(client, process_callback, arg);
  113. #else
  114. return 0;
  115. #endif
  116. }
  117. int jackbridge_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback freewheel_callback, void* arg)
  118. {
  119. #ifndef JACKBRIDGE_DUMMY
  120. return jack_set_freewheel_callback(client, freewheel_callback, arg);
  121. #else
  122. return 0;
  123. #endif
  124. }
  125. int jackbridge_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback bufsize_callback, void* arg)
  126. {
  127. #ifndef JACKBRIDGE_DUMMY
  128. return jack_set_buffer_size_callback(client, bufsize_callback, arg);
  129. #else
  130. return 0;
  131. #endif
  132. }
  133. int jackbridge_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback srate_callback, void* arg)
  134. {
  135. #ifndef JACKBRIDGE_DUMMY
  136. return jack_set_sample_rate_callback(client, srate_callback, arg);
  137. #else
  138. return 0;
  139. #endif
  140. }
  141. jack_nframes_t jackbridge_get_sample_rate(jack_client_t* client)
  142. {
  143. #ifndef JACKBRIDGE_DUMMY
  144. return jack_get_sample_rate(client);
  145. #else
  146. return 0;
  147. #endif
  148. }
  149. jack_nframes_t jackbridge_get_buffer_size(jack_client_t* client)
  150. {
  151. #ifndef JACKBRIDGE_DUMMY
  152. return jack_get_buffer_size(client);
  153. #else
  154. return 0;
  155. #endif
  156. }
  157. 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)
  158. {
  159. #ifndef JACKBRIDGE_DUMMY
  160. return jack_port_register(client, port_name, port_type, flags, buffer_size);
  161. #else
  162. return NULL;
  163. #endif
  164. }
  165. int jackbridge_port_unregister(jack_client_t* client, jack_port_t* port)
  166. {
  167. #ifndef JACKBRIDGE_DUMMY
  168. return jack_port_unregister(client, port);
  169. #else
  170. return 0;
  171. #endif
  172. }
  173. void* jackbridge_port_get_buffer(jack_port_t* port, jack_nframes_t nframes)
  174. {
  175. #ifndef JACKBRIDGE_DUMMY
  176. return jack_port_get_buffer(port, nframes);
  177. #else
  178. return NULL;
  179. #endif
  180. }
  181. // -----------------------------------------------------------------------------
  182. uint32_t jackbridge_midi_get_event_count(void* port_buffer)
  183. {
  184. #ifndef JACKBRIDGE_DUMMY
  185. return jack_midi_get_event_count(port_buffer);
  186. #else
  187. return 0;
  188. #endif
  189. }
  190. int jackbridge_midi_event_get(jack_midi_event_t* event, void* port_buffer, uint32_t event_index)
  191. {
  192. #ifndef JACKBRIDGE_DUMMY
  193. return jack_midi_event_get(event, port_buffer, event_index);
  194. #else
  195. return 0;
  196. #endif
  197. }
  198. void jackbridge_midi_clear_buffer(void* port_buffer)
  199. {
  200. #ifndef JACKBRIDGE_DUMMY
  201. jack_midi_clear_buffer(port_buffer);
  202. #endif
  203. }
  204. jack_midi_data_t* jackbridge_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size)
  205. {
  206. #ifndef JACKBRIDGE_DUMMY
  207. return jack_midi_event_reserve(port_buffer, time, data_size);
  208. #else
  209. return NULL;
  210. #endif
  211. }
  212. int jackbridge_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size)
  213. {
  214. #ifndef JACKBRIDGE_DUMMY
  215. return jack_midi_event_write(port_buffer, time, data, data_size);
  216. #else
  217. return 0;
  218. #endif
  219. }
  220. // -----------------------------------------------------------------------------
  221. jack_transport_state_t jackbridge_transport_query(const jack_client_t* client, jack_position_t* pos)
  222. {
  223. #ifndef JACKBRIDGE_DUMMY
  224. return jack_transport_query(client, pos);
  225. #else
  226. return JackTransportStopped;
  227. #endif
  228. }