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.

1071 lines
27KB

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