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

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