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.

1009 lines
25KB

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