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.

259 lines
6.0KB

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