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.

239 lines
8.8KB

  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 "carla_backend.hpp"
  20. // TODO - create struct for internal plugin info
  21. // TODO - dont strdup() on const-char* returns, use static char[STR_MAX]
  22. /*!
  23. * @defgroup CarlaBackendStandalone Carla Backend Standalone
  24. *
  25. * The Carla Backend Standalone API
  26. *
  27. * @{
  28. */
  29. typedef CarlaBackend::BinaryType CarlaBinaryType;
  30. typedef CarlaBackend::PluginType CarlaPluginType;
  31. typedef CarlaBackend::PluginCategory CarlaPluginCategory;
  32. typedef CarlaBackend::OptionsType CarlaOptionsType;
  33. typedef CarlaBackend::CallbackFunc CarlaCallbackFunc;
  34. struct CarlaPluginInfo {
  35. CarlaPluginType type;
  36. CarlaPluginCategory category;
  37. unsigned int hints;
  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. binary(nullptr),
  50. name(nullptr),
  51. label(nullptr),
  52. maker(nullptr),
  53. copyright(nullptr),
  54. uniqueId(0),
  55. latency(0) {}
  56. ~CarlaPluginInfo()
  57. {
  58. std::free((void*)label);
  59. std::free((void*)maker);
  60. std::free((void*)copyright);
  61. }
  62. };
  63. struct CarlaNativePluginInfo {
  64. CarlaPluginCategory category;
  65. unsigned int hints;
  66. uint32_t audioIns;
  67. uint32_t audioOuts;
  68. uint32_t midiIns;
  69. uint32_t midiOuts;
  70. uint32_t parameterIns;
  71. uint32_t parameterOuts;
  72. const char* name;
  73. const char* label;
  74. const char* maker;
  75. const char* copyright;
  76. CarlaNativePluginInfo()
  77. : category(CarlaBackend::PLUGIN_CATEGORY_NONE),
  78. hints(0x0),
  79. audioIns(0),
  80. audioOuts(0),
  81. midiIns(0),
  82. midiOuts(0),
  83. parameterIns(0),
  84. parameterOuts(0),
  85. name(nullptr),
  86. label(nullptr),
  87. maker(nullptr),
  88. copyright(nullptr) {}
  89. };
  90. struct CarlaPortCountInfo {
  91. uint32_t ins;
  92. uint32_t outs;
  93. uint32_t total;
  94. CarlaPortCountInfo()
  95. : ins(0),
  96. outs(0),
  97. total(0) {}
  98. };
  99. struct CarlaParameterInfo {
  100. const char* name;
  101. const char* symbol;
  102. const char* unit;
  103. uint32_t scalePointCount;
  104. CarlaParameterInfo()
  105. : name(nullptr),
  106. symbol(nullptr),
  107. unit(nullptr),
  108. scalePointCount(0) {}
  109. ~CarlaParameterInfo()
  110. {
  111. std::free((void*)name);
  112. std::free((void*)symbol);
  113. std::free((void*)unit);
  114. }
  115. };
  116. struct CarlaScalePointInfo {
  117. float value;
  118. const char* label;
  119. CarlaScalePointInfo()
  120. : value(0.0f),
  121. label(nullptr) {}
  122. ~CarlaScalePointInfo()
  123. {
  124. std::free((void*)label);
  125. }
  126. };
  127. CARLA_EXPORT const char* carla_get_extended_license_text();
  128. CARLA_EXPORT unsigned int carla_get_engine_driver_count();
  129. CARLA_EXPORT const char* carla_get_engine_driver_name(unsigned int index);
  130. CARLA_EXPORT unsigned int carla_get_internal_plugin_count();
  131. CARLA_EXPORT const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int internalPluginId);
  132. CARLA_EXPORT bool carla_engine_init(const char* driverName, const char* clientName);
  133. CARLA_EXPORT bool carla_engine_close();
  134. CARLA_EXPORT void carla_engine_idle();
  135. CARLA_EXPORT bool carla_is_engine_running();
  136. CARLA_EXPORT bool carla_load_project(const char* filename);
  137. CARLA_EXPORT bool carla_save_project(const char* filename);
  138. CARLA_EXPORT bool carla_add_plugin(CarlaBinaryType btype, CarlaPluginType ptype, const char* filename, const char* name, const char* label, void* extraPtr);
  139. CARLA_EXPORT bool carla_remove_plugin(unsigned int pluginId);
  140. CARLA_EXPORT void carla_remove_all_plugins();
  141. //CARLA_EXPORT bool carla_load_plugin_state(unsigned int pluginId, const char* filename);
  142. //CARLA_EXPORT bool carla_save_plugin_state(unsigned int pluginId, const char* filename);
  143. CARLA_EXPORT const CarlaPluginInfo* carla_get_plugin_info(unsigned int pluginId);
  144. CARLA_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(unsigned int pluginId);
  145. CARLA_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(unsigned int pluginId);
  146. CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(unsigned int pluginId);
  147. CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(unsigned int pluginId, uint32_t parameterId);
  148. CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(unsigned int pluginId, uint32_t parameterId, uint32_t scalePointId);
  149. CARLA_EXPORT const CarlaBackend::ParameterData* carla_get_parameter_data(unsigned int pluginId, uint32_t parameterId);
  150. CARLA_EXPORT const CarlaBackend::ParameterRanges* carla_get_parameter_ranges(unsigned int pluginId, uint32_t parameterId);
  151. CARLA_EXPORT const CarlaBackend::MidiProgramData* carla_get_midi_program_data(unsigned int pluginId, uint32_t midiProgramId);
  152. CARLA_EXPORT const CarlaBackend::CustomData* carla_get_custom_data(unsigned int pluginId, uint32_t customDataId);
  153. CARLA_EXPORT const char* carla_get_chunk_data(unsigned int pluginId);
  154. CARLA_EXPORT uint32_t carla_get_parameter_count(unsigned int pluginId);
  155. CARLA_EXPORT uint32_t carla_get_program_count(unsigned int pluginId);
  156. CARLA_EXPORT uint32_t carla_get_midi_program_count(unsigned int pluginId);
  157. CARLA_EXPORT uint32_t carla_get_custom_data_count(unsigned int pluginId);
  158. CARLA_EXPORT const char* carla_get_parameter_text(unsigned int pluginId, uint32_t parameterId);
  159. CARLA_EXPORT const char* carla_get_program_name(unsigned int pluginId, uint32_t programId);
  160. CARLA_EXPORT const char* carla_get_midi_program_name(unsigned int pluginId, uint32_t midiProgramId);
  161. CARLA_EXPORT const char* carla_get_real_plugin_name(unsigned int pluginId);
  162. CARLA_EXPORT int32_t carla_get_current_program_index(unsigned int pluginId);
  163. CARLA_EXPORT int32_t carla_get_current_midi_program_index(unsigned int pluginId);
  164. CARLA_EXPORT float carla_get_default_parameter_value(unsigned int pluginId, uint32_t parameterId);
  165. CARLA_EXPORT float carla_get_current_parameter_value(unsigned int pluginId, uint32_t parameterId);
  166. CARLA_EXPORT float carla_get_input_peak_value(unsigned int pluginId, unsigned short portId);
  167. CARLA_EXPORT float carla_get_output_peak_value(unsigned int pluginId, unsigned short portId);
  168. CARLA_EXPORT void carla_set_active(unsigned int pluginId, bool onOff);
  169. CARLA_EXPORT void carla_set_drywet(unsigned int pluginId, float value);
  170. CARLA_EXPORT void carla_set_volume(unsigned int pluginId, float value);
  171. CARLA_EXPORT void carla_set_balance_left(unsigned int pluginId, float value);
  172. CARLA_EXPORT void carla_set_balance_right(unsigned int pluginId, float value);
  173. CARLA_EXPORT void carla_set_panning(unsigned int pluginId, float value);
  174. CARLA_EXPORT void carla_set_parameter_value(unsigned int pluginId, uint32_t parameterId, float value);
  175. CARLA_EXPORT void carla_set_parameter_midi_channel(unsigned int pluginId, uint32_t parameterId, uint8_t channel);
  176. CARLA_EXPORT void carla_set_parameter_midi_cc(unsigned int pluginId, uint32_t parameterId, int16_t cc);
  177. CARLA_EXPORT void carla_set_program(unsigned int pluginId, uint32_t programId);
  178. CARLA_EXPORT void carla_set_midi_program(unsigned int pluginId, uint32_t midiProgramId);
  179. CARLA_EXPORT void carla_set_custom_data(unsigned int pluginId, const char* type, const char* key, const char* value);
  180. CARLA_EXPORT void carla_set_chunk_data(unsigned int pluginId, const char* chunkData);
  181. CARLA_EXPORT void carla_prepare_for_save(unsigned int pluginId);
  182. CARLA_EXPORT void carla_send_midi_note(unsigned int pluginId, uint8_t channel, uint8_t note, uint8_t velocity);
  183. CARLA_EXPORT void carla_show_gui(unsigned int pluginId, bool yesNo);
  184. CARLA_EXPORT uint32_t carla_get_buffer_size();
  185. CARLA_EXPORT double carla_get_sample_rate();
  186. CARLA_EXPORT const char* carla_get_last_error();
  187. CARLA_EXPORT const char* carla_get_host_osc_url();
  188. CARLA_EXPORT void carla_set_callback_function(CarlaCallbackFunc func);
  189. CARLA_EXPORT void carla_set_option(CarlaOptionsType option, int value, const char* valueStr);
  190. #if 0
  191. CARLA_EXPORT void carla_nsm_announce(const char* url, int pid);
  192. CARLA_EXPORT void carla_nsm_reply_open();
  193. CARLA_EXPORT void carla_nsm_reply_save();
  194. #endif
  195. /**@}*/
  196. #endif // __CARLA_STANDALONE_HPP__