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.

1043 lines
25KB

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