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.

961 lines
24KB

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