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.

256 lines
9.5KB

  1. /*
  2. * Carla Standalone API
  3. * Copyright (C) 2011-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 General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or 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 GPL.txt file
  16. */
  17. #ifndef __CARLA_STANDALONE_HPP__
  18. #define __CARLA_STANDALONE_HPP__
  19. #include "CarlaBackend.hpp"
  20. /*!
  21. * @defgroup CarlaBackendStandalone Carla Backend Standalone
  22. *
  23. * The Carla Backend Standalone API
  24. *
  25. * @{
  26. */
  27. typedef CarlaBackend::BinaryType CarlaBinaryType;
  28. typedef CarlaBackend::PluginType CarlaPluginType;
  29. typedef CarlaBackend::PluginCategory CarlaPluginCategory;
  30. typedef CarlaBackend::OptionsType CarlaOptionsType;
  31. typedef CarlaBackend::CallbackFunc CarlaCallbackFunc;
  32. struct CarlaPluginInfo {
  33. CarlaPluginType type;
  34. CarlaPluginCategory category;
  35. unsigned int hints;
  36. unsigned int optionsAvailable;
  37. unsigned int optionsEnabled;
  38. const char* binary;
  39. const char* name;
  40. const char* label;
  41. const char* maker;
  42. const char* copyright;
  43. long uniqueId;
  44. uint32_t latency;
  45. CarlaPluginInfo()
  46. : type(CarlaBackend::PLUGIN_NONE),
  47. category(CarlaBackend::PLUGIN_CATEGORY_NONE),
  48. hints(0x0),
  49. optionsAvailable(0x0),
  50. optionsEnabled(0x0),
  51. binary(nullptr),
  52. name(nullptr),
  53. label(nullptr),
  54. maker(nullptr),
  55. copyright(nullptr),
  56. uniqueId(0),
  57. latency(0) {}
  58. ~CarlaPluginInfo()
  59. {
  60. if (label != nullptr)
  61. delete[] label;
  62. if (maker != nullptr)
  63. delete[] maker;
  64. if (copyright != nullptr)
  65. delete[] copyright;
  66. }
  67. };
  68. struct CarlaNativePluginInfo {
  69. CarlaPluginCategory category;
  70. unsigned int hints;
  71. uint32_t audioIns;
  72. uint32_t audioOuts;
  73. uint32_t midiIns;
  74. uint32_t midiOuts;
  75. uint32_t parameterIns;
  76. uint32_t parameterOuts;
  77. const char* name;
  78. const char* label;
  79. const char* maker;
  80. const char* copyright;
  81. CarlaNativePluginInfo()
  82. : category(CarlaBackend::PLUGIN_CATEGORY_NONE),
  83. hints(0x0),
  84. audioIns(0),
  85. audioOuts(0),
  86. midiIns(0),
  87. midiOuts(0),
  88. parameterIns(0),
  89. parameterOuts(0),
  90. name(nullptr),
  91. label(nullptr),
  92. maker(nullptr),
  93. copyright(nullptr) {}
  94. };
  95. struct CarlaPortCountInfo {
  96. uint32_t ins;
  97. uint32_t outs;
  98. uint32_t total;
  99. CarlaPortCountInfo()
  100. : ins(0),
  101. outs(0),
  102. total(0) {}
  103. };
  104. struct CarlaParameterInfo {
  105. const char* name;
  106. const char* symbol;
  107. const char* unit;
  108. uint32_t scalePointCount;
  109. CarlaParameterInfo()
  110. : name(nullptr),
  111. symbol(nullptr),
  112. unit(nullptr),
  113. scalePointCount(0) {}
  114. ~CarlaParameterInfo()
  115. {
  116. if (name != nullptr)
  117. delete[] name;
  118. if (symbol != nullptr)
  119. delete[] symbol;
  120. if (unit != nullptr)
  121. delete[] unit;
  122. }
  123. };
  124. struct CarlaScalePointInfo {
  125. float value;
  126. const char* label;
  127. CarlaScalePointInfo()
  128. : value(0.0f),
  129. label(nullptr) {}
  130. ~CarlaScalePointInfo()
  131. {
  132. if (label != nullptr)
  133. delete[] label;
  134. }
  135. };
  136. CARLA_EXPORT const char* carla_get_extended_license_text();
  137. CARLA_EXPORT unsigned int carla_get_engine_driver_count();
  138. CARLA_EXPORT const char* carla_get_engine_driver_name(unsigned int index);
  139. CARLA_EXPORT unsigned int carla_get_internal_plugin_count();
  140. CARLA_EXPORT const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int internalPluginId);
  141. CARLA_EXPORT bool carla_engine_init(const char* driverName, const char* clientName);
  142. CARLA_EXPORT bool carla_engine_close();
  143. CARLA_EXPORT void carla_engine_idle();
  144. CARLA_EXPORT bool carla_is_engine_running();
  145. CARLA_EXPORT void carla_set_engine_about_to_close();
  146. CARLA_EXPORT void carla_set_engine_callback(CarlaCallbackFunc func, void* ptr);
  147. CARLA_EXPORT void carla_set_engine_option(CarlaOptionsType option, int value, const char* valueStr);
  148. CARLA_EXPORT bool carla_load_project(const char* filename);
  149. CARLA_EXPORT bool carla_save_project(const char* filename);
  150. CARLA_EXPORT void carla_patchbay_connect(int portA, int portB);
  151. CARLA_EXPORT void carla_patchbay_disconnect(int connectionId);
  152. CARLA_EXPORT void carla_transport_play();
  153. CARLA_EXPORT void carla_transport_pause();
  154. CARLA_EXPORT void carla_transport_relocate(uint32_t frames);
  155. CARLA_EXPORT bool carla_add_plugin(CarlaBinaryType btype, CarlaPluginType ptype, const char* filename, const char* name, const char* label, const void* extraPtr);
  156. CARLA_EXPORT bool carla_remove_plugin(unsigned int pluginId);
  157. CARLA_EXPORT void carla_remove_all_plugins();
  158. CARLA_EXPORT bool carla_load_plugin_state(unsigned int pluginId, const char* filename);
  159. CARLA_EXPORT bool carla_save_plugin_state(unsigned int pluginId, const char* filename);
  160. CARLA_EXPORT const CarlaPluginInfo* carla_get_plugin_info(unsigned int pluginId);
  161. CARLA_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(unsigned int pluginId);
  162. CARLA_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(unsigned int pluginId);
  163. CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(unsigned int pluginId);
  164. CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(unsigned int pluginId, uint32_t parameterId);
  165. CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(unsigned int pluginId, uint32_t parameterId, uint32_t scalePointId);
  166. CARLA_EXPORT const CarlaBackend::ParameterData* carla_get_parameter_data(unsigned int pluginId, uint32_t parameterId);
  167. CARLA_EXPORT const CarlaBackend::ParameterRanges* carla_get_parameter_ranges(unsigned int pluginId, uint32_t parameterId);
  168. CARLA_EXPORT const CarlaBackend::MidiProgramData* carla_get_midi_program_data(unsigned int pluginId, uint32_t midiProgramId);
  169. CARLA_EXPORT const CarlaBackend::CustomData* carla_get_custom_data(unsigned int pluginId, uint32_t customDataId);
  170. CARLA_EXPORT const char* carla_get_chunk_data(unsigned int pluginId);
  171. CARLA_EXPORT uint32_t carla_get_parameter_count(unsigned int pluginId);
  172. CARLA_EXPORT uint32_t carla_get_program_count(unsigned int pluginId);
  173. CARLA_EXPORT uint32_t carla_get_midi_program_count(unsigned int pluginId);
  174. CARLA_EXPORT uint32_t carla_get_custom_data_count(unsigned int pluginId);
  175. CARLA_EXPORT const char* carla_get_parameter_text(unsigned int pluginId, uint32_t parameterId);
  176. CARLA_EXPORT const char* carla_get_program_name(unsigned int pluginId, uint32_t programId);
  177. CARLA_EXPORT const char* carla_get_midi_program_name(unsigned int pluginId, uint32_t midiProgramId);
  178. CARLA_EXPORT const char* carla_get_real_plugin_name(unsigned int pluginId);
  179. CARLA_EXPORT int32_t carla_get_current_program_index(unsigned int pluginId);
  180. CARLA_EXPORT int32_t carla_get_current_midi_program_index(unsigned int pluginId);
  181. CARLA_EXPORT float carla_get_default_parameter_value(unsigned int pluginId, uint32_t parameterId);
  182. CARLA_EXPORT float carla_get_current_parameter_value(unsigned int pluginId, uint32_t parameterId);
  183. CARLA_EXPORT float carla_get_input_peak_value(unsigned int pluginId, unsigned short portId);
  184. CARLA_EXPORT float carla_get_output_peak_value(unsigned int pluginId, unsigned short portId);
  185. CARLA_EXPORT void carla_set_option(unsigned int pluginId, unsigned int option, bool yesNo);
  186. CARLA_EXPORT void carla_set_active(unsigned int pluginId, bool onOff);
  187. CARLA_EXPORT void carla_set_drywet(unsigned int pluginId, float value);
  188. CARLA_EXPORT void carla_set_volume(unsigned int pluginId, float value);
  189. CARLA_EXPORT void carla_set_balance_left(unsigned int pluginId, float value);
  190. CARLA_EXPORT void carla_set_balance_right(unsigned int pluginId, float value);
  191. CARLA_EXPORT void carla_set_panning(unsigned int pluginId, float value);
  192. CARLA_EXPORT void carla_set_ctrl_channel(unsigned int pluginId, int8_t channel);
  193. CARLA_EXPORT void carla_set_parameter_value(unsigned int pluginId, uint32_t parameterId, float value);
  194. CARLA_EXPORT void carla_set_parameter_midi_channel(unsigned int pluginId, uint32_t parameterId, uint8_t channel);
  195. CARLA_EXPORT void carla_set_parameter_midi_cc(unsigned int pluginId, uint32_t parameterId, int16_t cc);
  196. CARLA_EXPORT void carla_set_program(unsigned int pluginId, uint32_t programId);
  197. CARLA_EXPORT void carla_set_midi_program(unsigned int pluginId, uint32_t midiProgramId);
  198. CARLA_EXPORT void carla_set_custom_data(unsigned int pluginId, const char* type, const char* key, const char* value);
  199. CARLA_EXPORT void carla_set_chunk_data(unsigned int pluginId, const char* chunkData);
  200. CARLA_EXPORT void carla_prepare_for_save(unsigned int pluginId);
  201. CARLA_EXPORT void carla_send_midi_note(unsigned int pluginId, uint8_t channel, uint8_t note, uint8_t velocity);
  202. CARLA_EXPORT void carla_show_gui(unsigned int pluginId, bool yesNo);
  203. CARLA_EXPORT uint32_t carla_get_buffer_size();
  204. CARLA_EXPORT double carla_get_sample_rate();
  205. CARLA_EXPORT const char* carla_get_last_error();
  206. CARLA_EXPORT const char* carla_get_host_osc_url();
  207. #if 0
  208. CARLA_EXPORT void carla_nsm_announce(const char* url, int pid);
  209. CARLA_EXPORT void carla_nsm_reply_open();
  210. CARLA_EXPORT void carla_nsm_reply_save();
  211. #endif
  212. /**@}*/
  213. #endif // __CARLA_STANDALONE_HPP__