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.

1080 lines
26KB

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