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

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