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.

1000 lines
25KB

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