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.

1014 lines
26KB

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