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.

984 lines
24KB

  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. /*!
  324. * Get how many internal plugins are available.
  325. */
  326. CARLA_EXPORT uint carla_get_internal_plugin_count();
  327. /*!
  328. * Get information about an internal plugin.
  329. * @param index Internal plugin Id
  330. */
  331. CARLA_EXPORT const CarlaNativePluginInfo* carla_get_internal_plugin_info(uint index);
  332. #ifdef __cplusplus
  333. /*!
  334. * Get the currently used engine, maybe be NULL.
  335. * @note C++ only
  336. */
  337. CARLA_EXPORT const CarlaEngine* carla_get_engine();
  338. #endif
  339. /*!
  340. * Initialize the engine.\n
  341. * Make sure to call carla_engine_idle() at regular intervals afterwards.
  342. * @param driverName Driver to use
  343. * @param clientName Engine master client name
  344. */
  345. CARLA_EXPORT bool carla_engine_init(const char* driverName, const char* clientName);
  346. #ifdef BUILD_BRIDGE
  347. /*!
  348. * Initialize the engine in bridged mode.
  349. * @param audioBaseName Shared memory key for audio pool
  350. * @param controlBaseName Shared memory key for control messages
  351. * @param timeBaseName Shared memory key for time info
  352. * @param clientName Engine master client name
  353. */
  354. 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);
  355. #endif
  356. /*!
  357. * Close the engine.\n
  358. * This function always closes the engine even if it returns false.\n
  359. * In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
  360. */
  361. CARLA_EXPORT bool carla_engine_close();
  362. /*!
  363. * Idle the engine.\n
  364. * Do not call this if the engine is not running.
  365. */
  366. CARLA_EXPORT void carla_engine_idle();
  367. /*!
  368. * Check if the engine is running.
  369. */
  370. CARLA_EXPORT bool carla_is_engine_running();
  371. /*!
  372. * Tell the engine it's about to close.\n
  373. * This is used to prevent the engine thread(s) from reactivating.
  374. */
  375. CARLA_EXPORT void carla_set_engine_about_to_close();
  376. /*!
  377. * Set the engine callback function.
  378. * @param func Callback function
  379. * @param ptr Callback pointer
  380. */
  381. CARLA_EXPORT void carla_set_engine_callback(EngineCallbackFunc func, void* ptr);
  382. #ifndef BUILD_BRIDGE
  383. /*!
  384. * Set an engine option.
  385. * @param option Option
  386. * @param value Value as number
  387. * @param valueStr Value as string
  388. */
  389. CARLA_EXPORT void carla_set_engine_option(EngineOption option, int value, const char* valueStr);
  390. #endif
  391. /*!
  392. * Set the file callback function.
  393. * @param func Callback function
  394. * @param ptr Callback pointer
  395. */
  396. CARLA_EXPORT void carla_set_file_callback(FileCallbackFunc func, void* ptr);
  397. /*!
  398. * Load a file of any type.\n
  399. * This will try to load a generic file as a plugin,
  400. * either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
  401. * @param Filename Filename
  402. * @see carla_get_supported_file_extensions()
  403. */
  404. CARLA_EXPORT bool carla_load_file(const char* filename);
  405. /*!
  406. * Load a Carla project file.
  407. * @param Filename Filename
  408. * @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
  409. */
  410. CARLA_EXPORT bool carla_load_project(const char* filename);
  411. /*!
  412. * Save current project to a file.
  413. * @param Filename Filename
  414. */
  415. CARLA_EXPORT bool carla_save_project(const char* filename);
  416. #ifndef BUILD_BRIDGE
  417. /*!
  418. * Connect two patchbay ports.
  419. * @param groupIdA Output group
  420. * @param portIdA Output port
  421. * @param groupIdB Input group
  422. * @param portIdB Input port
  423. * @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  424. */
  425. CARLA_EXPORT bool carla_patchbay_connect(uint groupIdA, uint portIdA, uint groupIdB, uint portIdB);
  426. /*!
  427. * Disconnect two patchbay ports.
  428. * @param connectionId Connection Id
  429. * @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  430. */
  431. CARLA_EXPORT bool carla_patchbay_disconnect(uint connectionId);
  432. /*!
  433. * Force the engine to resend all patchbay clients, ports and connections again.
  434. */
  435. CARLA_EXPORT bool carla_patchbay_refresh();
  436. #endif
  437. /*!
  438. * Start playback of the engine transport.
  439. */
  440. CARLA_EXPORT void carla_transport_play();
  441. /*!
  442. * Pause the engine transport.
  443. */
  444. CARLA_EXPORT void carla_transport_pause();
  445. /*!
  446. * Relocate the engine transport to a specific frame.
  447. * @param frames Frame to relocate to.
  448. */
  449. CARLA_EXPORT void carla_transport_relocate(uint64_t frame);
  450. /*!
  451. * Get the current transport frame.
  452. */
  453. CARLA_EXPORT uint64_t carla_get_current_transport_frame();
  454. /*!
  455. * Get the engine transport information.
  456. */
  457. CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info();
  458. /*!
  459. * Add a new plugin.\n
  460. * If you don't know the binary type use the BINARY_NATIVE macro.
  461. * @param btype Binary type
  462. * @param ptype Plugin type
  463. * @param filename Filename, if applicable
  464. * @param name Name of the plugin, can be NULL
  465. * @param label Plugin label, if applicable
  466. * @param uniqueId Plugin unique Id, if applicable
  467. * @param extraPtr Extra pointer, defined per plugin type
  468. */
  469. 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);
  470. /*!
  471. * Remove one plugin.
  472. * @param pluginId Plugin to remove.
  473. */
  474. CARLA_EXPORT bool carla_remove_plugin(uint pluginId);
  475. /*!
  476. * Remove all plugins.
  477. */
  478. CARLA_EXPORT bool carla_remove_all_plugins();
  479. #ifndef BUILD_BRIDGE
  480. /*!
  481. * Rename a plugin.\n
  482. * Returns the new name, or NULL if the operation failed.
  483. * @param pluginId Plugin to rename
  484. * @param newName New plugin name
  485. */
  486. CARLA_EXPORT const char* carla_rename_plugin(uint pluginId, const char* newName);
  487. /*!
  488. * Clone a plugin.
  489. * @param pluginId Plugin to clone
  490. */
  491. CARLA_EXPORT bool carla_clone_plugin(uint pluginId);
  492. /*!
  493. * Prepare replace of a plugin.\n
  494. * The next call to carla_add_plugin() will use this id, replacing the current plugin.
  495. * @param pluginId Plugin to replace
  496. * @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  497. */
  498. CARLA_EXPORT bool carla_replace_plugin(uint pluginId);
  499. /*!
  500. * Switch two plugins positions.
  501. * @param pluginIdA Plugin A
  502. * @param pluginIdB Plugin B
  503. */
  504. CARLA_EXPORT bool carla_switch_plugins(uint pluginIdA, uint pluginIdB);
  505. #endif
  506. /*!
  507. * Load a plugin state.
  508. * @param pluginId Plugin
  509. * @param filename Path to plugin state
  510. * @see carla_save_plugin_state()
  511. */
  512. CARLA_EXPORT bool carla_load_plugin_state(uint pluginId, const char* filename);
  513. /*!
  514. * Save a plugin state.
  515. * @param pluginId Plugin
  516. * @param filename Path to plugin state
  517. * @see carla_load_plugin_state()
  518. */
  519. CARLA_EXPORT bool carla_save_plugin_state(uint pluginId, const char* filename);
  520. /*!
  521. * Get information from a plugin.
  522. * @param pluginId Plugin
  523. */
  524. CARLA_EXPORT const CarlaPluginInfo* carla_get_plugin_info(uint pluginId);
  525. /*!
  526. * Get audio port count information from a plugin.
  527. * @param pluginId Plugin
  528. */
  529. CARLA_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(uint pluginId);
  530. /*!
  531. * Get MIDI port count information from a plugin.
  532. * @param pluginId Plugin
  533. */
  534. CARLA_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(uint pluginId);
  535. /*!
  536. * Get parameter count information from a plugin.
  537. * @param pluginId Plugin
  538. */
  539. CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(uint pluginId);
  540. /*!
  541. * Get parameter information from a plugin.
  542. * @param pluginId Plugin
  543. * @param parameterId Parameter index
  544. * @see carla_get_parameter_count()
  545. */
  546. CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t parameterId);
  547. /*!
  548. * Get parameter scale point information from a plugin.
  549. * @param pluginId Plugin
  550. * @param parameterId Parameter index
  551. * @param scalePointId Parameter scale-point index
  552. * @see CarlaParameterInfo::scalePointCount
  553. */
  554. CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, uint32_t parameterId, uint32_t scalePointId);
  555. /*!
  556. * Get a plugin's parameter data.
  557. * @param pluginId Plugin
  558. * @param parameterId Parameter index
  559. * @see carla_get_parameter_count()
  560. */
  561. CARLA_EXPORT const ParameterData* carla_get_parameter_data(uint pluginId, uint32_t parameterId);
  562. /*!
  563. * Get a plugin's parameter ranges.
  564. * @param pluginId Plugin
  565. * @param parameterId Parameter index
  566. * @see carla_get_parameter_count()
  567. */
  568. CARLA_EXPORT const ParameterRanges* carla_get_parameter_ranges(uint pluginId, uint32_t parameterId);
  569. /*!
  570. * Get a plugin's MIDI program data.
  571. * @param pluginId Plugin
  572. * @param midiProgramId MIDI Program index
  573. * @see carla_get_midi_program_count()
  574. */
  575. CARLA_EXPORT const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiProgramId);
  576. /*!
  577. * Get a plugin's custom data.
  578. * @param pluginId Plugin
  579. * @param customDataId Custom data index
  580. * @see carla_get_custom_data_count()
  581. */
  582. CARLA_EXPORT const CustomData* carla_get_custom_data(uint pluginId, uint32_t customDataId);
  583. /*!
  584. * Get a plugin's chunk data.
  585. * @param pluginId Plugin
  586. * @see PLUGIN_OPTION_USE_CHUNKS and carla_set_chunk_data()
  587. */
  588. CARLA_EXPORT const char* carla_get_chunk_data(uint pluginId);
  589. /*!
  590. * Get how many parameters a plugin has.
  591. * @param pluginId Plugin
  592. */
  593. CARLA_EXPORT uint32_t carla_get_parameter_count(uint pluginId);
  594. /*!
  595. * Get how many programs a plugin has.
  596. * @param pluginId Plugin
  597. * @see carla_get_program_name()
  598. */
  599. CARLA_EXPORT uint32_t carla_get_program_count(uint pluginId);
  600. /*!
  601. * Get how many MIDI programs a plugin has.
  602. * @param pluginId Plugin
  603. * @see carla_get_midi_program_name() and carla_get_midi_program_data()
  604. */
  605. CARLA_EXPORT uint32_t carla_get_midi_program_count(uint pluginId);
  606. /*!
  607. * Get how many custom data sets a plugin has.
  608. * @param pluginId Plugin
  609. * @see carla_get_custom_data()
  610. */
  611. CARLA_EXPORT uint32_t carla_get_custom_data_count(uint pluginId);
  612. /*!
  613. * Get a plugin's parameter text (custom display of internal values).
  614. * @param pluginId Plugin
  615. * @param parameterId Parameter index
  616. * @see PARAMETER_USES_CUSTOM_TEXT
  617. */
  618. CARLA_EXPORT const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId);
  619. /*!
  620. * Get a plugin's program name.
  621. * @param pluginId Plugin
  622. * @param programId Program index
  623. * @see carla_get_program_count()
  624. */
  625. CARLA_EXPORT const char* carla_get_program_name(uint pluginId, uint32_t programId);
  626. /*!
  627. * Get a plugin's MIDI program name.
  628. * @param pluginId Plugin
  629. * @param midiProgramId MIDI Program index
  630. * @see carla_get_midi_program_count()
  631. */
  632. CARLA_EXPORT const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId);
  633. /*!
  634. * Get a plugin's real name.\n
  635. * This is the name the plugin uses to identify itself; may not be unique.
  636. * @param pluginId Plugin
  637. */
  638. CARLA_EXPORT const char* carla_get_real_plugin_name(uint pluginId);
  639. /*!
  640. * Get a plugin's program index.
  641. * @param pluginId Plugin
  642. */
  643. CARLA_EXPORT int32_t carla_get_current_program_index(uint pluginId);
  644. /*!
  645. * Get a plugin's midi program index.
  646. * @param pluginId Plugin
  647. */
  648. CARLA_EXPORT int32_t carla_get_current_midi_program_index(uint pluginId);
  649. /*!
  650. * Get a plugin's default parameter value.
  651. * @param pluginId Plugin
  652. * @param parameterId Parameter index
  653. */
  654. CARLA_EXPORT float carla_get_default_parameter_value(uint pluginId, uint32_t parameterId);
  655. /*!
  656. * Get a plugin's current parameter value.
  657. * @param pluginId Plugin
  658. * @param parameterId Parameter index
  659. */
  660. CARLA_EXPORT float carla_get_current_parameter_value(uint pluginId, uint32_t parameterId);
  661. /*!
  662. * Get a plugin's internal parameter value.
  663. * @param pluginId Plugin
  664. * @param parameterId Parameter index, maybe be negative
  665. * @see InternalParameterIndex
  666. */
  667. CARLA_EXPORT float carla_get_internal_parameter_value(uint pluginId, int32_t parameterId);
  668. /*!
  669. * Get a plugin's input peak value.
  670. * @param pluginId Plugin
  671. * @param isLeft Wherever to get the left/mono value, otherwise right.
  672. */
  673. CARLA_EXPORT float carla_get_input_peak_value(uint pluginId, bool isLeft);
  674. /*!
  675. * Get a plugin's output peak value.
  676. * @param pluginId Plugin
  677. * @param isLeft Wherever to get the left/mono value, otherwise right.
  678. */
  679. CARLA_EXPORT float carla_get_output_peak_value(uint pluginId, bool isLeft);
  680. /*!
  681. * Enable a plugin's option.
  682. * @param pluginId Plugin
  683. * @param option An option from PluginOptions
  684. * @param yesNo New enabled state
  685. */
  686. CARLA_EXPORT void carla_set_option(uint pluginId, uint option, bool yesNo);
  687. /*!
  688. * Enable or disable a plugin.
  689. * @param pluginId Plugin
  690. * @param onOff New active state
  691. */
  692. CARLA_EXPORT void carla_set_active(uint pluginId, bool onOff);
  693. #ifndef BUILD_BRIDGE
  694. /*!
  695. * Change a plugin's internal dry/wet.
  696. * @param pluginId Plugin
  697. * @param value New dry/wet value
  698. */
  699. CARLA_EXPORT void carla_set_drywet(uint pluginId, float value);
  700. /*!
  701. * Change a plugin's internal volume.
  702. * @param pluginId Plugin
  703. * @param value New volume
  704. */
  705. CARLA_EXPORT void carla_set_volume(uint pluginId, float value);
  706. /*!
  707. * Change a plugin's internal stereo balance, left channel.
  708. * @param pluginId Plugin
  709. * @param value New value
  710. */
  711. CARLA_EXPORT void carla_set_balance_left(uint pluginId, float value);
  712. /*!
  713. * Change a plugin's internal stereo balance, right channel.
  714. * @param pluginId Plugin
  715. * @param value New value
  716. */
  717. CARLA_EXPORT void carla_set_balance_right(uint pluginId, float value);
  718. /*!
  719. * Change a plugin's internal mono panning value.
  720. * @param pluginId Plugin
  721. * @param value New value
  722. */
  723. CARLA_EXPORT void carla_set_panning(uint pluginId, float value);
  724. #endif
  725. /*!
  726. * Change a plugin's internal control channel.
  727. * @param pluginId Plugin
  728. * @param channel New channel
  729. */
  730. CARLA_EXPORT void carla_set_ctrl_channel(uint pluginId, int8_t channel);
  731. /*!
  732. * Change a plugin's parameter value.
  733. * @param pluginId Plugin
  734. * @param parameterId Parameter index
  735. * @param value New value
  736. */
  737. CARLA_EXPORT void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value);
  738. #ifndef BUILD_BRIDGE
  739. /*!
  740. * Change a plugin's parameter MIDI channel.
  741. * @param pluginId Plugin
  742. * @param parameterId Parameter index
  743. * @param channel New MIDI channel
  744. */
  745. CARLA_EXPORT void carla_set_parameter_midi_channel(uint pluginId, uint32_t parameterId, uint8_t channel);
  746. /*!
  747. * Change a plugin's parameter MIDI cc.
  748. * @param pluginId Plugin
  749. * @param parameterId Parameter index
  750. * @param cc New MIDI cc
  751. */
  752. CARLA_EXPORT void carla_set_parameter_midi_cc(uint pluginId, uint32_t parameterId, int16_t cc);
  753. #endif
  754. /*!
  755. * Change a plugin's current program.
  756. * @param pluginId Plugin
  757. * @param programId New program
  758. */
  759. CARLA_EXPORT void carla_set_program(uint pluginId, uint32_t programId);
  760. /*!
  761. * Change a plugin's current MIDI program.
  762. * @param pluginId Plugin
  763. * @param midiProgramId New value
  764. */
  765. CARLA_EXPORT void carla_set_midi_program(uint pluginId, uint32_t midiProgramId);
  766. /*!
  767. * Set a plugin's custom data set.
  768. * @param pluginId Plugin
  769. * @param type Type
  770. * @param key Key
  771. * @param value New value
  772. * @see CustomDataTypes and CustomDataKeys
  773. */
  774. CARLA_EXPORT void carla_set_custom_data(uint pluginId, const char* type, const char* key, const char* value);
  775. /*!
  776. * Set a plugin's chunk data.
  777. * @param pluginId Plugin
  778. * @param value New value
  779. * @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  780. */
  781. CARLA_EXPORT void carla_set_chunk_data(uint pluginId, const char* chunkData);
  782. /*!
  783. * Tell a plugin to prepare for save.\n
  784. * This should be called before saving custom data sets.
  785. * @param pluginId Plugin
  786. */
  787. CARLA_EXPORT void carla_prepare_for_save(uint pluginId);
  788. /*!
  789. * Reset all plugin's parameters.
  790. * @param pluginId Plugin
  791. */
  792. CARLA_EXPORT void carla_reset_parameters(uint pluginId);
  793. /*!
  794. * Randomize all plugin's parameters.
  795. * @param pluginId Plugin
  796. */
  797. CARLA_EXPORT void carla_randomize_parameters(uint pluginId);
  798. #ifndef BUILD_BRIDGE
  799. /*!
  800. * Send a single note of a plugin.\n
  801. * If velocity is 0, note-off is sent; note-on otherwise.
  802. * @param pluginId Plugin
  803. * @param channel Note channel
  804. * @param note Note pitch
  805. * @param velocity Note velocity
  806. */
  807. CARLA_EXPORT void carla_send_midi_note(uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity);
  808. #endif
  809. /*!
  810. * Tell a plugin to show its own custom UI.
  811. * @param pluginId Plugin
  812. * @param yesNo New UI state, visible or not
  813. * @see PLUGIN_HAS_CUSTOM_UI
  814. */
  815. CARLA_EXPORT void carla_show_custom_ui(uint pluginId, bool yesNo);
  816. /*!
  817. * Get the current engine buffer size.
  818. */
  819. CARLA_EXPORT uint32_t carla_get_buffer_size();
  820. /*!
  821. * Get the current engine sample rate.
  822. */
  823. CARLA_EXPORT double carla_get_sample_rate();
  824. /*!
  825. * Get the last error.
  826. */
  827. CARLA_EXPORT const char* carla_get_last_error();
  828. /*!
  829. * Get the current engine OSC URL (TCP).
  830. */
  831. CARLA_EXPORT const char* carla_get_host_osc_url_tcp();
  832. /*!
  833. * Get the current engine OSC URL (UDP).
  834. */
  835. CARLA_EXPORT const char* carla_get_host_osc_url_udp();
  836. /** @} */
  837. #endif /* CARLA_HOST_H_INCLUDED */