Collection of tools useful for audio production
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.

188 lines
7.1KB

  1. /*
  2. * Carla Backend
  3. * Copyright (C) 2011-2012 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. #ifndef CARLA_BACKEND_STANDALONE_H
  18. #define CARLA_BACKEND_STANDALONE_H
  19. #include <cstdint>
  20. #include "carla_backend.hpp"
  21. // TODO - create struct for internal plugin info
  22. // TODO - dont strdup() on const-char* returns
  23. // TODO - set_option caching values
  24. /*!
  25. * @defgroup CarlaBackendStandalone Carla Backend Standalone
  26. *
  27. * The Carla Backend Standalone API
  28. *
  29. * @{
  30. */
  31. struct PluginInfo {
  32. CarlaBackend::PluginType type;
  33. CarlaBackend::PluginCategory category;
  34. unsigned int hints;
  35. const char* binary;
  36. const char* name;
  37. const char* label;
  38. const char* maker;
  39. const char* copyright;
  40. long uniqueId;
  41. PluginInfo()
  42. : type(CarlaBackend::PLUGIN_NONE),
  43. category(CarlaBackend::PLUGIN_CATEGORY_NONE),
  44. hints(0x0),
  45. binary(nullptr),
  46. name(nullptr),
  47. label(nullptr),
  48. maker(nullptr),
  49. copyright(nullptr),
  50. uniqueId(0) {}
  51. };
  52. struct PortCountInfo {
  53. uint32_t ins;
  54. uint32_t outs;
  55. uint32_t total;
  56. PortCountInfo()
  57. : ins(0),
  58. outs(0),
  59. total(0) {}
  60. };
  61. struct ParameterInfo {
  62. const char* name;
  63. const char* symbol;
  64. const char* unit;
  65. uint32_t scalePointCount;
  66. ParameterInfo()
  67. : name(nullptr),
  68. symbol(nullptr),
  69. unit(nullptr),
  70. scalePointCount(0) {}
  71. };
  72. struct ScalePointInfo {
  73. double value;
  74. const char* label;
  75. ScalePointInfo()
  76. : value(0.0),
  77. label(nullptr) {}
  78. };
  79. struct GuiInfo {
  80. CarlaBackend::GuiType type;
  81. bool resizable;
  82. GuiInfo()
  83. : type(CarlaBackend::GUI_NONE),
  84. resizable(false) {}
  85. };
  86. CARLA_EXPORT const char* get_extended_license_text();
  87. CARLA_EXPORT unsigned int get_engine_driver_count();
  88. CARLA_EXPORT const char* get_engine_driver_name(unsigned int index);
  89. CARLA_EXPORT unsigned int get_internal_plugin_count();
  90. CARLA_EXPORT const PluginInfo* get_internal_plugin_info(unsigned int plugin_id);
  91. CARLA_EXPORT bool engine_init(const char* driver_name, const char* client_name);
  92. CARLA_EXPORT bool engine_close();
  93. CARLA_EXPORT bool is_engine_running();
  94. CARLA_EXPORT short add_plugin(CarlaBackend::BinaryType btype, CarlaBackend::PluginType ptype, const char* filename, const char* name, const char* label, void* extra_stuff);
  95. CARLA_EXPORT bool remove_plugin(unsigned short plugin_id);
  96. CARLA_EXPORT const PluginInfo* get_plugin_info(unsigned short plugin_id);
  97. CARLA_EXPORT const PortCountInfo* get_audio_port_count_info(unsigned short plugin_id);
  98. CARLA_EXPORT const PortCountInfo* get_midi_port_count_info(unsigned short plugin_id);
  99. CARLA_EXPORT const PortCountInfo* get_parameter_count_info(unsigned short plugin_id);
  100. CARLA_EXPORT const ParameterInfo* get_parameter_info(unsigned short plugin_id, uint32_t parameter_id);
  101. CARLA_EXPORT const ScalePointInfo* get_parameter_scalepoint_info(unsigned short plugin_id, uint32_t parameter_id, uint32_t scalepoint_id);
  102. CARLA_EXPORT const GuiInfo* get_gui_info(unsigned short plugin_id);
  103. CARLA_EXPORT const CarlaBackend::ParameterData* get_parameter_data(unsigned short plugin_id, uint32_t parameter_id);
  104. CARLA_EXPORT const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short plugin_id, uint32_t parameter_id);
  105. CARLA_EXPORT const CarlaBackend::MidiProgramData* get_midi_program_data(unsigned short plugin_id, uint32_t midi_program_id);
  106. CARLA_EXPORT const CarlaBackend::CustomData* get_custom_data(unsigned short plugin_id, uint32_t custom_data_id);
  107. CARLA_EXPORT const char* get_chunk_data(unsigned short plugin_id);
  108. CARLA_EXPORT uint32_t get_parameter_count(unsigned short plugin_id);
  109. CARLA_EXPORT uint32_t get_program_count(unsigned short plugin_id);
  110. CARLA_EXPORT uint32_t get_midi_program_count(unsigned short plugin_id);
  111. CARLA_EXPORT uint32_t get_custom_data_count(unsigned short plugin_id);
  112. CARLA_EXPORT const char* get_parameter_text(unsigned short plugin_id, uint32_t parameter_id);
  113. CARLA_EXPORT const char* get_program_name(unsigned short plugin_id, uint32_t program_id);
  114. CARLA_EXPORT const char* get_midi_program_name(unsigned short plugin_id, uint32_t midi_program_id);
  115. CARLA_EXPORT const char* get_real_plugin_name(unsigned short plugin_id);
  116. CARLA_EXPORT int32_t get_current_program_index(unsigned short plugin_id);
  117. CARLA_EXPORT int32_t get_current_midi_program_index(unsigned short plugin_id);
  118. CARLA_EXPORT double get_default_parameter_value(unsigned short plugin_id, uint32_t parameter_id);
  119. CARLA_EXPORT double get_current_parameter_value(unsigned short plugin_id, uint32_t parameter_id);
  120. CARLA_EXPORT double get_input_peak_value(unsigned short plugin_id, unsigned short port_id);
  121. CARLA_EXPORT double get_output_peak_value(unsigned short plugin_id, unsigned short port_id);
  122. CARLA_EXPORT void set_active(unsigned short plugin_id, bool onoff);
  123. CARLA_EXPORT void set_drywet(unsigned short plugin_id, double value);
  124. CARLA_EXPORT void set_volume(unsigned short plugin_id, double value);
  125. CARLA_EXPORT void set_balance_left(unsigned short plugin_id, double value);
  126. CARLA_EXPORT void set_balance_right(unsigned short plugin_id, double value);
  127. CARLA_EXPORT void set_parameter_value(unsigned short plugin_id, uint32_t parameter_id, double value);
  128. CARLA_EXPORT void set_parameter_midi_channel(unsigned short plugin_id, uint32_t parameter_id, uint8_t channel);
  129. CARLA_EXPORT void set_parameter_midi_cc(unsigned short plugin_id, uint32_t parameter_id, int16_t cc);
  130. CARLA_EXPORT void set_program(unsigned short plugin_id, uint32_t program_id);
  131. CARLA_EXPORT void set_midi_program(unsigned short plugin_id, uint32_t midi_program_id);
  132. CARLA_EXPORT void set_custom_data(unsigned short plugin_id, CarlaBackend::CustomDataType dtype, const char* key, const char* value);
  133. CARLA_EXPORT void set_chunk_data(unsigned short plugin_id, const char* chunk_data);
  134. CARLA_EXPORT void set_gui_container(unsigned short plugin_id, uintptr_t gui_addr);
  135. CARLA_EXPORT void show_gui(unsigned short plugin_id, bool yesno);
  136. CARLA_EXPORT void idle_guis();
  137. CARLA_EXPORT void send_midi_note(unsigned short plugin_id, uint8_t channel, uint8_t note, uint8_t velocity);
  138. CARLA_EXPORT void prepare_for_save(unsigned short plugin_id);
  139. CARLA_EXPORT uint32_t get_buffer_size();
  140. CARLA_EXPORT double get_sample_rate();
  141. CARLA_EXPORT const char* get_last_error();
  142. CARLA_EXPORT const char* get_host_osc_url();
  143. CARLA_EXPORT void set_callback_function(CarlaBackend::CallbackFunc func);
  144. CARLA_EXPORT void set_option(CarlaBackend::OptionsType option, int value, const char* value_str);
  145. CARLA_EXPORT void nsm_announce(const char* url, int pid);
  146. CARLA_EXPORT void nsm_reply_open();
  147. CARLA_EXPORT void nsm_reply_save();
  148. /**@}*/
  149. #endif // CARLA_BACKEND_STANDALONE_H