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.

CarlaHost.h 24KB

6 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
6 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-2018 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 doc/GPL.txt file.
  16. */
  17. #ifndef CARLA_HOST_H_INCLUDED
  18. #define CARLA_HOST_H_INCLUDED
  19. #include "CarlaBackend.h"
  20. #ifdef __cplusplus
  21. using CarlaBackend::BinaryType;
  22. using CarlaBackend::PluginType;
  23. using CarlaBackend::PluginCategory;
  24. using CarlaBackend::InternalParameterIndex;
  25. using CarlaBackend::EngineCallbackOpcode;
  26. using CarlaBackend::EngineOption;
  27. using CarlaBackend::EngineProcessMode;
  28. using CarlaBackend::EngineTransportMode;
  29. using CarlaBackend::FileCallbackOpcode;
  30. using CarlaBackend::EngineCallbackFunc;
  31. using CarlaBackend::FileCallbackFunc;
  32. using CarlaBackend::ParameterData;
  33. using CarlaBackend::ParameterRanges;
  34. using CarlaBackend::MidiProgramData;
  35. using CarlaBackend::CustomData;
  36. using CarlaBackend::EngineDriverDeviceInfo;
  37. using CarlaBackend::CarlaEngine;
  38. using CarlaBackend::CarlaEngineClient;
  39. using CarlaBackend::CarlaPlugin;
  40. #endif
  41. /*!
  42. * @defgroup CarlaHostAPI Carla Host API
  43. *
  44. * The Carla Host API.
  45. *
  46. * This API makes it possible to use the Carla Backend in a standalone host application..
  47. *
  48. * None of the returned values in this API calls need to be deleted or free'd.
  49. * When a function fails (returns false or NULL), use carla_get_last_error() to find out what went wrong.
  50. * @{
  51. */
  52. /* ------------------------------------------------------------------------------------------------------------
  53. * Carla Host API (C stuff) */
  54. /*!
  55. * Information about a loaded plugin.
  56. * @see carla_get_plugin_info()
  57. */
  58. typedef struct _CarlaPluginInfo {
  59. /*!
  60. * Plugin type.
  61. */
  62. PluginType type;
  63. /*!
  64. * Plugin category.
  65. */
  66. PluginCategory category;
  67. /*!
  68. * Plugin hints.
  69. * @see PluginHints
  70. */
  71. uint hints;
  72. /*!
  73. * Plugin options available for the user to change.
  74. * @see PluginOptions
  75. */
  76. uint optionsAvailable;
  77. /*!
  78. * Plugin options currently enabled.
  79. * Some options are enabled but not available, which means they will always be on.
  80. * @see PluginOptions
  81. */
  82. uint optionsEnabled;
  83. /*!
  84. * Plugin filename.
  85. * This can be the plugin binary or resource file.
  86. */
  87. const char* filename;
  88. /*!
  89. * Plugin name.
  90. * This name is unique within a Carla instance.
  91. * @see carla_get_real_plugin_name()
  92. */
  93. const char* name;
  94. /*!
  95. * Plugin label or URI.
  96. */
  97. const char* label;
  98. /*!
  99. * Plugin author/maker.
  100. */
  101. const char* maker;
  102. /*!
  103. * Plugin copyright/license.
  104. */
  105. const char* copyright;
  106. /*!
  107. * Icon name for this plugin, in lowercase.
  108. * Default is "plugin".
  109. */
  110. const char* iconName;
  111. /*!
  112. * Plugin unique Id.
  113. * This Id is dependant on the plugin type and may sometimes be 0.
  114. */
  115. int64_t uniqueId;
  116. #ifdef __cplusplus
  117. /*!
  118. * C++ constructor and destructor.
  119. */
  120. CARLA_API _CarlaPluginInfo() noexcept;
  121. CARLA_API ~_CarlaPluginInfo() noexcept;
  122. CARLA_DECLARE_NON_COPY_STRUCT(_CarlaPluginInfo)
  123. #endif
  124. } CarlaPluginInfo;
  125. /*!
  126. * Port count information, used for Audio and MIDI ports and parameters.
  127. * @see carla_get_audio_port_count_info()
  128. * @see carla_get_midi_port_count_info()
  129. * @see carla_get_parameter_count_info()
  130. */
  131. typedef struct _CarlaPortCountInfo {
  132. /*!
  133. * Number of inputs.
  134. */
  135. uint32_t ins;
  136. /*!
  137. * Number of outputs.
  138. */
  139. uint32_t outs;
  140. } CarlaPortCountInfo;
  141. /*!
  142. * Parameter information.
  143. * @see carla_get_parameter_info()
  144. */
  145. typedef struct _CarlaParameterInfo {
  146. /*!
  147. * Parameter name.
  148. */
  149. const char* name;
  150. /*!
  151. * Parameter symbol.
  152. */
  153. const char* symbol;
  154. /*!
  155. * Parameter unit.
  156. */
  157. const char* unit;
  158. /*!
  159. * Number of scale points.
  160. * @see CarlaScalePointInfo
  161. */
  162. uint32_t scalePointCount;
  163. #ifdef __cplusplus
  164. /*!
  165. * C++ constructor and destructor.
  166. */
  167. CARLA_API _CarlaParameterInfo() noexcept;
  168. CARLA_API ~_CarlaParameterInfo() noexcept;
  169. CARLA_DECLARE_NON_COPY_STRUCT(_CarlaParameterInfo)
  170. #endif
  171. } CarlaParameterInfo;
  172. /*!
  173. * Parameter scale point information.
  174. * @see carla_get_parameter_scalepoint_info()
  175. */
  176. typedef struct _CarlaScalePointInfo {
  177. /*!
  178. * Scale point value.
  179. */
  180. float value;
  181. /*!
  182. * Scale point label.
  183. */
  184. const char* label;
  185. #ifdef __cplusplus
  186. /*!
  187. * C++ constructor and destructor.
  188. */
  189. CARLA_API _CarlaScalePointInfo() noexcept;
  190. CARLA_API ~_CarlaScalePointInfo() noexcept;
  191. CARLA_DECLARE_NON_COPY_STRUCT(_CarlaScalePointInfo)
  192. #endif
  193. } CarlaScalePointInfo;
  194. /*!
  195. * Transport information.
  196. * @see carla_get_transport_info()
  197. */
  198. typedef struct _CarlaTransportInfo {
  199. /*!
  200. * Wherever transport is playing.
  201. */
  202. bool playing;
  203. /*!
  204. * Current transport frame.
  205. */
  206. uint64_t frame;
  207. /*!
  208. * Bar.
  209. */
  210. int32_t bar;
  211. /*!
  212. * Beat.
  213. */
  214. int32_t beat;
  215. /*!
  216. * Tick.
  217. */
  218. int32_t tick;
  219. /*!
  220. * Beats per minute.
  221. */
  222. double bpm;
  223. #ifdef __cplusplus
  224. /*!
  225. * C++ constructor.
  226. */
  227. CARLA_API _CarlaTransportInfo() noexcept;
  228. /*!
  229. * Clear struct contents.
  230. */
  231. CARLA_API void clear() noexcept;
  232. #endif
  233. } CarlaTransportInfo;
  234. /*!
  235. * Image data for LV2 inline display API.
  236. * raw image pixmap format is ARGB32,
  237. */
  238. typedef struct {
  239. unsigned char* data;
  240. int width;
  241. int height;
  242. int stride;
  243. } CarlaInlineDisplayImageSurface;
  244. /* ------------------------------------------------------------------------------------------------------------
  245. * Carla Host API (C functions) */
  246. /*!
  247. * Get how many engine drivers are available.
  248. */
  249. CARLA_EXPORT uint carla_get_engine_driver_count();
  250. /*!
  251. * Get an engine driver name.
  252. * @param index Driver index
  253. */
  254. CARLA_EXPORT const char* carla_get_engine_driver_name(uint index);
  255. /*!
  256. * Get the device names of an engine driver.
  257. * @param index Driver index
  258. */
  259. CARLA_EXPORT const char* const* carla_get_engine_driver_device_names(uint index);
  260. /*!
  261. * Get information about a device driver.
  262. * @param index Driver index
  263. * @param name Device name
  264. */
  265. CARLA_EXPORT const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(uint index, const char* name);
  266. #ifdef __cplusplus
  267. /*!
  268. * Get the currently used engine, may be NULL.
  269. * @note C++ only
  270. */
  271. CARLA_EXPORT CarlaEngine* carla_get_engine();
  272. #endif
  273. /*!
  274. * Initialize the engine.
  275. * Make sure to call carla_engine_idle() at regular intervals afterwards.
  276. * @param driverName Driver to use
  277. * @param clientName Engine master client name
  278. */
  279. CARLA_EXPORT bool carla_engine_init(const char* driverName, const char* clientName);
  280. #ifdef BUILD_BRIDGE
  281. /*!
  282. * Initialize the engine in bridged mode.
  283. */
  284. CARLA_EXPORT bool carla_engine_init_bridge(const char audioBaseName[6+1], const char rtClientBaseName[6+1], const char nonRtClientBaseName[6+1],
  285. const char nonRtServerBaseName[6+1], const char* clientName);
  286. #endif
  287. /*!
  288. * Close the engine.
  289. * This function always closes the engine even if it returns false.
  290. * In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
  291. */
  292. CARLA_EXPORT bool carla_engine_close();
  293. /*!
  294. * Idle the engine.
  295. * Do not call this if the engine is not running.
  296. */
  297. CARLA_EXPORT void carla_engine_idle();
  298. /*!
  299. * Check if the engine is running.
  300. */
  301. CARLA_EXPORT bool carla_is_engine_running();
  302. /*!
  303. * Tell the engine it's about to close.
  304. * This is used to prevent the engine thread(s) from reactivating.
  305. * Returns true if there's no pending engine events.
  306. */
  307. CARLA_EXPORT bool carla_set_engine_about_to_close();
  308. /*!
  309. * Set the engine callback function.
  310. * @param func Callback function
  311. * @param ptr Callback pointer
  312. */
  313. CARLA_EXPORT void carla_set_engine_callback(EngineCallbackFunc func, void* ptr);
  314. #ifndef BUILD_BRIDGE
  315. /*!
  316. * Set an engine option.
  317. * @param option Option
  318. * @param value Value as number
  319. * @param valueStr Value as string
  320. */
  321. CARLA_EXPORT void carla_set_engine_option(EngineOption option, int value, const char* valueStr);
  322. #endif
  323. /*!
  324. * Set the file callback function.
  325. * @param func Callback function
  326. * @param ptr Callback pointer
  327. */
  328. CARLA_EXPORT void carla_set_file_callback(FileCallbackFunc func, void* ptr);
  329. /*!
  330. * Load a file of any type.
  331. * This will try to load a generic file as a plugin,
  332. * either by direct handling (SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
  333. * @see carla_get_supported_file_extensions()
  334. */
  335. CARLA_EXPORT bool carla_load_file(const char* filename);
  336. /*!
  337. * Load a Carla project file.
  338. * @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
  339. */
  340. CARLA_EXPORT bool carla_load_project(const char* filename);
  341. /*!
  342. * Save current project to a file.
  343. */
  344. CARLA_EXPORT bool carla_save_project(const char* filename);
  345. #ifndef BUILD_BRIDGE
  346. /*!
  347. * Connect two patchbay ports.
  348. * @param groupIdA Output group
  349. * @param portIdA Output port
  350. * @param groupIdB Input group
  351. * @param portIdB Input port
  352. * @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  353. */
  354. CARLA_EXPORT bool carla_patchbay_connect(uint groupIdA, uint portIdA, uint groupIdB, uint portIdB);
  355. /*!
  356. * Disconnect two patchbay ports.
  357. * @param connectionId Connection Id
  358. * @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  359. */
  360. CARLA_EXPORT bool carla_patchbay_disconnect(uint connectionId);
  361. /*!
  362. * Force the engine to resend all patchbay clients, ports and connections again.
  363. * @param external Wherever to show external/hardware ports instead of internal ones.
  364. * Only valid in patchbay engine mode, other modes will ignore this.
  365. */
  366. CARLA_EXPORT bool carla_patchbay_refresh(bool external);
  367. /*!
  368. * Start playback of the engine transport.
  369. */
  370. CARLA_EXPORT void carla_transport_play();
  371. /*!
  372. * Pause the engine transport.
  373. */
  374. CARLA_EXPORT void carla_transport_pause();
  375. /*!
  376. * Set the engine transport bpm.
  377. */
  378. CARLA_EXPORT void carla_transport_bpm(double bpm);
  379. /*!
  380. * Relocate the engine transport to a specific frame.
  381. */
  382. CARLA_EXPORT void carla_transport_relocate(uint64_t frame);
  383. /*!
  384. * Get the current transport frame.
  385. */
  386. CARLA_EXPORT uint64_t carla_get_current_transport_frame();
  387. /*!
  388. * Get the engine transport information.
  389. */
  390. CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info();
  391. #endif
  392. /*!
  393. * Current number of plugins loaded.
  394. */
  395. CARLA_EXPORT uint32_t carla_get_current_plugin_count();
  396. /*!
  397. * Maximum number of loadable plugins allowed.
  398. * Returns 0 if engine is not started.
  399. */
  400. CARLA_EXPORT uint32_t carla_get_max_plugin_number();
  401. /*!
  402. * Add a new plugin.
  403. * If you don't know the binary type use the BINARY_NATIVE macro.
  404. * @param btype Binary type
  405. * @param ptype Plugin type
  406. * @param filename Filename, if applicable
  407. * @param name Name of the plugin, can be NULL
  408. * @param label Plugin label, if applicable
  409. * @param uniqueId Plugin unique Id, if applicable
  410. * @param extraPtr Extra pointer, defined per plugin type
  411. * @param options Initial plugin options
  412. */
  413. CARLA_EXPORT bool carla_add_plugin(BinaryType btype, PluginType ptype,
  414. const char* filename, const char* name, const char* label, int64_t uniqueId,
  415. const void* extraPtr, uint options);
  416. /*!
  417. * Remove one plugin.
  418. * @param pluginId Plugin to remove.
  419. */
  420. CARLA_EXPORT bool carla_remove_plugin(uint pluginId);
  421. /*!
  422. * Remove all plugins.
  423. */
  424. CARLA_EXPORT bool carla_remove_all_plugins();
  425. #ifndef BUILD_BRIDGE
  426. /*!
  427. * Rename a plugin.
  428. * Returns the new name, or NULL if the operation failed.
  429. * @param pluginId Plugin to rename
  430. * @param newName New plugin name
  431. */
  432. CARLA_EXPORT const char* carla_rename_plugin(uint pluginId, const char* newName);
  433. /*!
  434. * Clone a plugin.
  435. * @param pluginId Plugin to clone
  436. */
  437. CARLA_EXPORT bool carla_clone_plugin(uint pluginId);
  438. /*!
  439. * Prepare replace of a plugin.
  440. * The next call to carla_add_plugin() will use this id, replacing the current plugin.
  441. * @param pluginId Plugin to replace
  442. * @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  443. */
  444. CARLA_EXPORT bool carla_replace_plugin(uint pluginId);
  445. /*!
  446. * Switch two plugins positions.
  447. * @param pluginIdA Plugin A
  448. * @param pluginIdB Plugin B
  449. */
  450. CARLA_EXPORT bool carla_switch_plugins(uint pluginIdA, uint pluginIdB);
  451. #endif
  452. /*!
  453. * Load a plugin state.
  454. * @param pluginId Plugin
  455. * @param filename Path to plugin state
  456. * @see carla_save_plugin_state()
  457. */
  458. CARLA_EXPORT bool carla_load_plugin_state(uint pluginId, const char* filename);
  459. /*!
  460. * Save a plugin state.
  461. * @param pluginId Plugin
  462. * @param filename Path to plugin state
  463. * @see carla_load_plugin_state()
  464. */
  465. CARLA_EXPORT bool carla_save_plugin_state(uint pluginId, const char* filename);
  466. /*!
  467. * Export plugin as LV2.
  468. * @param pluginId Plugin
  469. * @param lv2path Path to lv2 plugin folder
  470. */
  471. CARLA_EXPORT bool carla_export_plugin_lv2(uint pluginId, const char* lv2path);
  472. /*!
  473. * Get information from a plugin.
  474. * @param pluginId Plugin
  475. */
  476. CARLA_EXPORT const CarlaPluginInfo* carla_get_plugin_info(uint pluginId);
  477. /*!
  478. * Get audio port count information from a plugin.
  479. * @param pluginId Plugin
  480. */
  481. CARLA_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(uint pluginId);
  482. /*!
  483. * Get MIDI port count information from a plugin.
  484. * @param pluginId Plugin
  485. */
  486. CARLA_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(uint pluginId);
  487. /*!
  488. * Get parameter count information from a plugin.
  489. * @param pluginId Plugin
  490. */
  491. CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(uint pluginId);
  492. /*!
  493. * Get parameter information from a plugin.
  494. * @param pluginId Plugin
  495. * @param parameterId Parameter index
  496. * @see carla_get_parameter_count()
  497. */
  498. CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t parameterId);
  499. /*!
  500. * Get parameter scale point information from a plugin.
  501. * @param pluginId Plugin
  502. * @param parameterId Parameter index
  503. * @param scalePointId Parameter scale-point index
  504. * @see CarlaParameterInfo::scalePointCount
  505. */
  506. CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, uint32_t parameterId, uint32_t scalePointId);
  507. /*!
  508. * Get a plugin's parameter data.
  509. * @param pluginId Plugin
  510. * @param parameterId Parameter index
  511. * @see carla_get_parameter_count()
  512. */
  513. CARLA_EXPORT const ParameterData* carla_get_parameter_data(uint pluginId, uint32_t parameterId);
  514. /*!
  515. * Get a plugin's parameter ranges.
  516. * @param pluginId Plugin
  517. * @param parameterId Parameter index
  518. * @see carla_get_parameter_count()
  519. */
  520. CARLA_EXPORT const ParameterRanges* carla_get_parameter_ranges(uint pluginId, uint32_t parameterId);
  521. /*!
  522. * Get a plugin's MIDI program data.
  523. * @param pluginId Plugin
  524. * @param midiProgramId MIDI Program index
  525. * @see carla_get_midi_program_count()
  526. */
  527. CARLA_EXPORT const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiProgramId);
  528. /*!
  529. * Get a plugin's custom data, using index.
  530. * @param pluginId Plugin
  531. * @param customDataId Custom data index
  532. * @see carla_get_custom_data_count()
  533. */
  534. CARLA_EXPORT const CustomData* carla_get_custom_data(uint pluginId, uint32_t customDataId);
  535. /*!
  536. * Get a plugin's custom data value, using type and key.
  537. * @param pluginId Plugin
  538. * @param type Custom data type
  539. * @param key Custom data key
  540. * @see carla_get_custom_data_count()
  541. */
  542. CARLA_EXPORT const char* carla_get_custom_data_value(uint pluginId, const char* type, const char* key);
  543. /*!
  544. * Get a plugin's chunk data.
  545. * @param pluginId Plugin
  546. * @see PLUGIN_OPTION_USE_CHUNKS and carla_set_chunk_data()
  547. */
  548. CARLA_EXPORT const char* carla_get_chunk_data(uint pluginId);
  549. /*!
  550. * Get how many parameters a plugin has.
  551. * @param pluginId Plugin
  552. */
  553. CARLA_EXPORT uint32_t carla_get_parameter_count(uint pluginId);
  554. /*!
  555. * Get how many programs a plugin has.
  556. * @param pluginId Plugin
  557. * @see carla_get_program_name()
  558. */
  559. CARLA_EXPORT uint32_t carla_get_program_count(uint pluginId);
  560. /*!
  561. * Get how many MIDI programs a plugin has.
  562. * @param pluginId Plugin
  563. * @see carla_get_midi_program_name() and carla_get_midi_program_data()
  564. */
  565. CARLA_EXPORT uint32_t carla_get_midi_program_count(uint pluginId);
  566. /*!
  567. * Get how many custom data sets a plugin has.
  568. * @param pluginId Plugin
  569. * @see carla_get_custom_data()
  570. */
  571. CARLA_EXPORT uint32_t carla_get_custom_data_count(uint pluginId);
  572. /*!
  573. * Get a plugin's parameter text (custom display of internal values).
  574. * @param pluginId Plugin
  575. * @param parameterId Parameter index
  576. * @see PARAMETER_USES_CUSTOM_TEXT
  577. */
  578. CARLA_EXPORT const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId);
  579. /*!
  580. * Get a plugin's program name.
  581. * @param pluginId Plugin
  582. * @param programId Program index
  583. * @see carla_get_program_count()
  584. */
  585. CARLA_EXPORT const char* carla_get_program_name(uint pluginId, uint32_t programId);
  586. /*!
  587. * Get a plugin's MIDI program name.
  588. * @param pluginId Plugin
  589. * @param midiProgramId MIDI Program index
  590. * @see carla_get_midi_program_count()
  591. */
  592. CARLA_EXPORT const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId);
  593. /*!
  594. * Get a plugin's real name.
  595. * This is the name the plugin uses to identify itself; may not be unique.
  596. * @param pluginId Plugin
  597. */
  598. CARLA_EXPORT const char* carla_get_real_plugin_name(uint pluginId);
  599. /*!
  600. * Get a plugin's program index.
  601. * @param pluginId Plugin
  602. */
  603. CARLA_EXPORT int32_t carla_get_current_program_index(uint pluginId);
  604. /*!
  605. * Get a plugin's midi program index.
  606. * @param pluginId Plugin
  607. */
  608. CARLA_EXPORT int32_t carla_get_current_midi_program_index(uint pluginId);
  609. /*!
  610. * Get a plugin's default parameter value.
  611. * @param pluginId Plugin
  612. * @param parameterId Parameter index
  613. */
  614. CARLA_EXPORT float carla_get_default_parameter_value(uint pluginId, uint32_t parameterId);
  615. /*!
  616. * Get a plugin's current parameter value.
  617. * @param pluginId Plugin
  618. * @param parameterId Parameter index
  619. */
  620. CARLA_EXPORT float carla_get_current_parameter_value(uint pluginId, uint32_t parameterId);
  621. /*!
  622. * Get a plugin's internal parameter value.
  623. * @param pluginId Plugin
  624. * @param parameterId Parameter index, maybe be negative
  625. * @see InternalParameterIndex
  626. */
  627. CARLA_EXPORT float carla_get_internal_parameter_value(uint pluginId, int32_t parameterId);
  628. /*!
  629. * Get a plugin's peak values.
  630. * @param pluginId Plugin
  631. */
  632. CARLA_EXPORT float* carla_get_peak_values(uint pluginId);
  633. /*!
  634. * Get a plugin's input peak value.
  635. * @param pluginId Plugin
  636. * @param isLeft Wherever to get the left/mono value, otherwise right.
  637. */
  638. CARLA_EXPORT float carla_get_input_peak_value(uint pluginId, bool isLeft);
  639. /*!
  640. * Get a plugin's output peak value.
  641. * @param pluginId Plugin
  642. * @param isLeft Wherever to get the left/mono value, otherwise right.
  643. */
  644. CARLA_EXPORT float carla_get_output_peak_value(uint pluginId, bool isLeft);
  645. /*!
  646. * Render a plugin's inline display.
  647. * @param pluginId Plugin
  648. */
  649. CARLA_EXPORT CarlaInlineDisplayImageSurface* carla_render_inline_display(uint pluginId, int width, int height);
  650. /*!
  651. * Enable or disable a plugin.
  652. * @param pluginId Plugin
  653. * @param onOff New active state
  654. */
  655. CARLA_EXPORT void carla_set_active(uint pluginId, bool onOff);
  656. #ifndef BUILD_BRIDGE
  657. /*!
  658. * Change a plugin's internal dry/wet.
  659. * @param pluginId Plugin
  660. * @param value New dry/wet value
  661. */
  662. CARLA_EXPORT void carla_set_drywet(uint pluginId, float value);
  663. /*!
  664. * Change a plugin's internal volume.
  665. * @param pluginId Plugin
  666. * @param value New volume
  667. */
  668. CARLA_EXPORT void carla_set_volume(uint pluginId, float value);
  669. /*!
  670. * Change a plugin's internal stereo balance, left channel.
  671. * @param pluginId Plugin
  672. * @param value New value
  673. */
  674. CARLA_EXPORT void carla_set_balance_left(uint pluginId, float value);
  675. /*!
  676. * Change a plugin's internal stereo balance, right channel.
  677. * @param pluginId Plugin
  678. * @param value New value
  679. */
  680. CARLA_EXPORT void carla_set_balance_right(uint pluginId, float value);
  681. /*!
  682. * Change a plugin's internal mono panning value.
  683. * @param pluginId Plugin
  684. * @param value New value
  685. */
  686. CARLA_EXPORT void carla_set_panning(uint pluginId, float value);
  687. /*!
  688. * Change a plugin's internal control channel.
  689. * @param pluginId Plugin
  690. * @param channel New channel
  691. */
  692. CARLA_EXPORT void carla_set_ctrl_channel(uint pluginId, int8_t channel);
  693. #endif
  694. /*!
  695. * Enable a plugin's option.
  696. * @param pluginId Plugin
  697. * @param option An option from PluginOptions
  698. * @param yesNo New enabled state
  699. */
  700. CARLA_EXPORT void carla_set_option(uint pluginId, uint option, bool yesNo);
  701. /*!
  702. * Change a plugin's parameter value.
  703. * @param pluginId Plugin
  704. * @param parameterId Parameter index
  705. * @param value New value
  706. */
  707. CARLA_EXPORT void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value);
  708. #ifndef BUILD_BRIDGE
  709. /*!
  710. * Change a plugin's parameter MIDI channel.
  711. * @param pluginId Plugin
  712. * @param parameterId Parameter index
  713. * @param channel New MIDI channel
  714. */
  715. CARLA_EXPORT void carla_set_parameter_midi_channel(uint pluginId, uint32_t parameterId, uint8_t channel);
  716. /*!
  717. * Change a plugin's parameter MIDI cc.
  718. * @param pluginId Plugin
  719. * @param parameterId Parameter index
  720. * @param cc New MIDI cc
  721. */
  722. CARLA_EXPORT void carla_set_parameter_midi_cc(uint pluginId, uint32_t parameterId, int16_t cc);
  723. #endif
  724. /*!
  725. * Change a plugin's current program.
  726. * @param pluginId Plugin
  727. * @param programId New program
  728. */
  729. CARLA_EXPORT void carla_set_program(uint pluginId, uint32_t programId);
  730. /*!
  731. * Change a plugin's current MIDI program.
  732. * @param pluginId Plugin
  733. * @param midiProgramId New value
  734. */
  735. CARLA_EXPORT void carla_set_midi_program(uint pluginId, uint32_t midiProgramId);
  736. /*!
  737. * Set a plugin's custom data set.
  738. * @param pluginId Plugin
  739. * @param type Type
  740. * @param key Key
  741. * @param value New value
  742. * @see CustomDataTypes and CustomDataKeys
  743. */
  744. CARLA_EXPORT void carla_set_custom_data(uint pluginId, const char* type, const char* key, const char* value);
  745. /*!
  746. * Set a plugin's chunk data.
  747. * @param pluginId Plugin
  748. * @param chunkData New chunk data
  749. * @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  750. */
  751. CARLA_EXPORT void carla_set_chunk_data(uint pluginId, const char* chunkData);
  752. /*!
  753. * Tell a plugin to prepare for save.
  754. * This should be called before saving custom data sets.
  755. * @param pluginId Plugin
  756. */
  757. CARLA_EXPORT void carla_prepare_for_save(uint pluginId);
  758. /*!
  759. * Reset all plugin's parameters.
  760. * @param pluginId Plugin
  761. */
  762. CARLA_EXPORT void carla_reset_parameters(uint pluginId);
  763. /*!
  764. * Randomize all plugin's parameters.
  765. * @param pluginId Plugin
  766. */
  767. CARLA_EXPORT void carla_randomize_parameters(uint pluginId);
  768. #ifndef BUILD_BRIDGE
  769. /*!
  770. * Send a single note of a plugin.
  771. * If velocity is 0, note-off is sent; note-on otherwise.
  772. * @param pluginId Plugin
  773. * @param channel Note channel
  774. * @param note Note pitch
  775. * @param velocity Note velocity
  776. */
  777. CARLA_EXPORT void carla_send_midi_note(uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity);
  778. #endif
  779. /*!
  780. * Tell a plugin to show its own custom UI.
  781. * @param pluginId Plugin
  782. * @param yesNo New UI state, visible or not
  783. * @see PLUGIN_HAS_CUSTOM_UI
  784. */
  785. CARLA_EXPORT void carla_show_custom_ui(uint pluginId, bool yesNo);
  786. /*!
  787. * Get the current engine buffer size.
  788. */
  789. CARLA_EXPORT uint32_t carla_get_buffer_size();
  790. /*!
  791. * Get the current engine sample rate.
  792. */
  793. CARLA_EXPORT double carla_get_sample_rate();
  794. /*!
  795. * Get the last error.
  796. */
  797. CARLA_EXPORT const char* carla_get_last_error();
  798. /*!
  799. * Get the current engine OSC URL (TCP).
  800. */
  801. CARLA_EXPORT const char* carla_get_host_osc_url_tcp();
  802. /*!
  803. * Get the current engine OSC URL (UDP).
  804. */
  805. CARLA_EXPORT const char* carla_get_host_osc_url_udp();
  806. /*!
  807. * Get the absolute filename of this carla library.
  808. */
  809. CARLA_EXPORT const char* carla_get_library_filename();
  810. /*!
  811. * Get the folder where this carla library resides.
  812. */
  813. CARLA_EXPORT const char* carla_get_library_folder();
  814. /** @} */
  815. #endif /* CARLA_HOST_H_INCLUDED */