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.

902 lines
23KB

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