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.h 5.8KB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. #ifndef __JACKBRIDGE_H__
  17. #define __JACKBRIDGE_H__
  18. #if defined(_WIN32) && ! defined(__WINE__)
  19. # include <stdint.h>
  20. # include <windows.h>
  21. # define BRIDGE_EXPORT __declspec (dllexport)
  22. #else
  23. # define BRIDGE_EXPORT __attribute__ ((visibility("default")))
  24. #endif
  25. #ifdef __WINE__
  26. # define GNU_WIN32 // fix jack_native_thread_t
  27. #endif
  28. #include <jack/jack.h>
  29. #include <jack/midiport.h>
  30. #include <jack/transport.h>
  31. #ifdef JACKBRIDGE_EXPORT
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. BRIDGE_EXPORT jack_client_t* jackbridge_client_open(const char* client_name, jack_options_t options, jack_status_t* status, ...);
  36. BRIDGE_EXPORT int jackbridge_client_close(jack_client_t* client);
  37. BRIDGE_EXPORT int jackbridge_client_name_size();
  38. BRIDGE_EXPORT char* jackbridge_get_client_name(jack_client_t* client);
  39. BRIDGE_EXPORT int jackbridge_port_name_size();
  40. BRIDGE_EXPORT int jackbridge_recompute_total_latencies(jack_client_t* client);
  41. BRIDGE_EXPORT void jackbridge_port_get_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range);
  42. BRIDGE_EXPORT void jackbridge_port_set_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range);
  43. BRIDGE_EXPORT int jackbridge_activate(jack_client_t* client);
  44. BRIDGE_EXPORT int jackbridge_deactivate(jack_client_t* client);
  45. BRIDGE_EXPORT void jackbridge_on_shutdown(jack_client_t* client, JackShutdownCallback shutdown_callback, void* arg);
  46. BRIDGE_EXPORT int jackbridge_set_latency_callback(jack_client_t* client, JackLatencyCallback latency_callback, void* arg);
  47. BRIDGE_EXPORT int jackbridge_set_process_callback(jack_client_t* client, JackProcessCallback process_callback, void* arg);
  48. BRIDGE_EXPORT int jackbridge_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback freewheel_callback, void* arg);
  49. BRIDGE_EXPORT int jackbridge_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback bufsize_callback, void* arg);
  50. BRIDGE_EXPORT int jackbridge_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback srate_callback, void* arg);
  51. BRIDGE_EXPORT jack_nframes_t jackbridge_get_sample_rate(jack_client_t* client);
  52. BRIDGE_EXPORT jack_nframes_t jackbridge_get_buffer_size(jack_client_t* client);
  53. BRIDGE_EXPORT 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);
  54. BRIDGE_EXPORT int jackbridge_port_unregister(jack_client_t* client, jack_port_t* port);
  55. BRIDGE_EXPORT void* jackbridge_port_get_buffer(jack_port_t* port, jack_nframes_t nframes);
  56. BRIDGE_EXPORT uint32_t jackbridge_midi_get_event_count(void* port_buffer);
  57. BRIDGE_EXPORT int jackbridge_midi_event_get(jack_midi_event_t* event, void* port_buffer, uint32_t event_index);
  58. BRIDGE_EXPORT void jackbridge_midi_clear_buffer(void* port_buffer);
  59. BRIDGE_EXPORT jack_midi_data_t* jackbridge_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size);
  60. BRIDGE_EXPORT int jackbridge_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size);
  61. BRIDGE_EXPORT int jackbridge_transport_locate(jack_client_t* client, jack_nframes_t frame);
  62. BRIDGE_EXPORT jack_transport_state_t jackbridge_transport_query(const jack_client_t* client, jack_position_t* pos);
  63. BRIDGE_EXPORT void jackbridge_transport_start(jack_client_t* client);
  64. BRIDGE_EXPORT void jackbridge_transport_stop(jack_client_t* client);
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. #else // JACKBRIDGE_EXPORT
  69. #define jackbridge_client_open jack_client_open
  70. #define jackbridge_client_close jack_client_close
  71. #define jackbridge_client_name_size jack_client_name_size
  72. #define jackbridge_get_client_name jack_get_client_name
  73. #define jackbridge_port_name_size jack_port_name_size
  74. #define jackbridge_recompute_total_latencies jack_recompute_total_latencies
  75. #define jackbridge_port_get_latency_range jack_port_get_latency_range
  76. #define jackbridge_port_set_latency_range jack_port_set_latency_range
  77. #define jackbridge_activate jack_activate
  78. #define jackbridge_deactivate jack_deactivate
  79. #define jackbridge_on_shutdown jack_on_shutdown
  80. #define jackbridge_set_latency_callback jack_set_latency_callback
  81. #define jackbridge_set_process_callback jack_set_process_callback
  82. #define jackbridge_set_freewheel_callback jack_set_freewheel_callback
  83. #define jackbridge_set_buffer_size_callback jack_set_buffer_size_callback
  84. #define jackbridge_set_sample_rate_callback jack_set_sample_rate_callback
  85. #define jackbridge_get_sample_rate jack_get_sample_rate
  86. #define jackbridge_get_buffer_size jack_get_buffer_size
  87. #define jackbridge_port_register jack_port_register
  88. #define jackbridge_port_unregister jack_port_unregister
  89. #define jackbridge_port_get_buffer jack_port_get_buffer
  90. #define jackbridge_midi_get_event_count jack_midi_get_event_count
  91. #define jackbridge_midi_event_get jack_midi_event_get
  92. #define jackbridge_midi_clear_buffer jack_midi_clear_buffer
  93. #define jackbridge_midi_event_reserve jack_midi_event_reserve
  94. #define jackbridge_midi_event_write jack_midi_event_write
  95. #define jackbridge_transport_locate jack_transport_locate
  96. #define jackbridge_transport_query jack_transport_query
  97. #define jackbridge_transport_start jack_transport_start
  98. #define jackbridge_transport_stop jack_transport_stop
  99. #endif // JACKBRIDGE_EXPORT
  100. #endif // __JACKBRIDGE_H__