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.

1078 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. /*!
  532. * Connect two patchbay ports.
  533. * @param portIdA Output port
  534. * @param portIdB Input port
  535. * @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  536. */
  537. CARLA_EXPORT bool carla_patchbay_connect(int portIdA, int portIdB);
  538. /*!
  539. * Disconnect two patchbay ports.
  540. * @param connectionId Connection Id
  541. * @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  542. */
  543. CARLA_EXPORT bool carla_patchbay_disconnect(int connectionId);
  544. /*!
  545. * Force the engine to resend all patchbay clients, ports and connections again.
  546. */
  547. CARLA_EXPORT bool carla_patchbay_refresh();
  548. /*!
  549. * Start playback of the engine transport.
  550. */
  551. CARLA_EXPORT void carla_transport_play();
  552. /*!
  553. * Pause the engine transport.
  554. */
  555. CARLA_EXPORT void carla_transport_pause();
  556. /*!
  557. * Relocate the engine transport to a specific frame.
  558. * @param frames Frame to relocate to.
  559. */
  560. CARLA_EXPORT void carla_transport_relocate(uint64_t frame);
  561. /*!
  562. * Get the current transport frame.
  563. */
  564. CARLA_EXPORT uint64_t carla_get_current_transport_frame();
  565. /*!
  566. * Get the engine transport information.
  567. */
  568. CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info();
  569. /*!
  570. * Add a new plugin.\n
  571. * If you don't know the binary type use the BINARY_NATIVE macro.
  572. * @param btype Binary type
  573. * @param ptype Plugin type
  574. * @param filename Filename, if applicable
  575. * @param name Name of the plugin, can be NULL
  576. * @param label Plugin label, if applicable
  577. * @param extraPtr Extra pointer, defined per plugin type
  578. */
  579. CARLA_EXPORT bool carla_add_plugin(BinaryType btype, PluginType ptype, const char* filename, const char* name, const char* label, const void* extraPtr);
  580. /*!
  581. * Remove one plugin.
  582. * @param pluginId Plugin to remove.
  583. */
  584. CARLA_EXPORT bool carla_remove_plugin(uint pluginId);
  585. /*!
  586. * Remove all plugins.
  587. */
  588. CARLA_EXPORT bool carla_remove_all_plugins();
  589. /*!
  590. * Rename a plugin.\n
  591. * Returns the new name, or NULL if the operation failed.
  592. * @param pluginId Plugin to rename
  593. * @param newName New plugin name
  594. */
  595. CARLA_EXPORT const char* carla_rename_plugin(uint pluginId, const char* newName);
  596. /*!
  597. * Clone a plugin.
  598. * @param pluginId Plugin to clone
  599. */
  600. CARLA_EXPORT bool carla_clone_plugin(uint pluginId);
  601. /*!
  602. * Prepare replace of a plugin.\n
  603. * The next call to carla_add_plugin() will use this id, replacing the current plugin.
  604. * @param pluginId Plugin to replace
  605. * @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  606. */
  607. CARLA_EXPORT bool carla_replace_plugin(uint pluginId);
  608. /*!
  609. * Switch two plugins positions.
  610. * @param pluginIdA Plugin A
  611. * @param pluginIdB Plugin B
  612. */
  613. CARLA_EXPORT bool carla_switch_plugins(uint pluginIdA, uint pluginIdB);
  614. /*!
  615. * Load a plugin state.
  616. * @param pluginId Plugin
  617. * @param filename Path to plugin state
  618. * @see carla_save_plugin_state()
  619. */
  620. CARLA_EXPORT bool carla_load_plugin_state(uint pluginId, const char* filename);
  621. /*!
  622. * Save a plugin state.
  623. * @param pluginId Plugin
  624. * @param filename Path to plugin state
  625. * @see carla_load_plugin_state()
  626. */
  627. CARLA_EXPORT bool carla_save_plugin_state(uint pluginId, const char* filename);
  628. /*!
  629. * Get information from a plugin.
  630. * @param pluginId Plugin
  631. */
  632. CARLA_EXPORT const CarlaPluginInfo* carla_get_plugin_info(uint pluginId);
  633. /*!
  634. * Get audio port count information from a plugin.
  635. * @param pluginId Plugin
  636. */
  637. CARLA_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(uint pluginId);
  638. /*!
  639. * Get MIDI port count information from a plugin.
  640. * @param pluginId Plugin
  641. */
  642. CARLA_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(uint pluginId);
  643. /*!
  644. * Get parameter count information from a plugin.
  645. * @param pluginId Plugin
  646. */
  647. CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(uint pluginId);
  648. /*!
  649. * Get parameter information from a plugin.
  650. * @param pluginId Plugin
  651. * @param parameterId Parameter index
  652. * @see carla_get_parameter_count()
  653. */
  654. CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t parameterId);
  655. /*!
  656. * Get parameter scale point information from a plugin.
  657. * @param pluginId Plugin
  658. * @param parameterId Parameter index
  659. * @param scalePointId Parameter scale-point index
  660. * @see CarlaParameterInfo::scalePointCount
  661. */
  662. CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, uint32_t parameterId, uint32_t scalePointId);
  663. /*!
  664. * Get a plugin's parameter data.
  665. * @param pluginId Plugin
  666. * @param parameterId Parameter index
  667. * @see carla_get_parameter_count()
  668. */
  669. CARLA_EXPORT const ParameterData* carla_get_parameter_data(uint pluginId, uint32_t parameterId);
  670. /*!
  671. * Get a plugin's parameter ranges.
  672. * @param pluginId Plugin
  673. * @param parameterId Parameter index
  674. * @see carla_get_parameter_count()
  675. */
  676. CARLA_EXPORT const ParameterRanges* carla_get_parameter_ranges(uint pluginId, uint32_t parameterId);
  677. /*!
  678. * Get a plugin's MIDI program data.
  679. * @param pluginId Plugin
  680. * @param midiProgramId MIDI Program index
  681. * @see carla_get_midi_program_count()
  682. */
  683. CARLA_EXPORT const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiProgramId);
  684. /*!
  685. * Get a plugin's custom data.
  686. * @param pluginId Plugin
  687. * @param customDataId Custom data index
  688. * @see carla_get_custom_data_count()
  689. */
  690. CARLA_EXPORT const CustomData* carla_get_custom_data(uint pluginId, uint32_t customDataId);
  691. /*!
  692. * Get a plugin's chunk data.
  693. * @param pluginId Plugin
  694. * @see PLUGIN_OPTION_USE_CHUNKS and carla_set_chunk_data()
  695. */
  696. CARLA_EXPORT const char* carla_get_chunk_data(uint pluginId);
  697. /*!
  698. * Get how many parameters a plugin has.
  699. * @param pluginId Plugin
  700. */
  701. CARLA_EXPORT uint32_t carla_get_parameter_count(uint pluginId);
  702. /*!
  703. * Get how many programs a plugin has.
  704. * @param pluginId Plugin
  705. * @see carla_get_program_name()
  706. */
  707. CARLA_EXPORT uint32_t carla_get_program_count(uint pluginId);
  708. /*!
  709. * Get how many MIDI programs a plugin has.
  710. * @param pluginId Plugin
  711. * @see carla_get_midi_program_name() and carla_get_midi_program_data()
  712. */
  713. CARLA_EXPORT uint32_t carla_get_midi_program_count(uint pluginId);
  714. /*!
  715. * Get how many custom data sets a plugin has.
  716. * @param pluginId Plugin
  717. * @see carla_get_custom_data()
  718. */
  719. CARLA_EXPORT uint32_t carla_get_custom_data_count(uint pluginId);
  720. /*!
  721. * Get a plugin's parameter text (custom display of internal values).
  722. * @param pluginId Plugin
  723. * @param parameterId Parameter index
  724. * @param value Parameter value
  725. * @see PARAMETER_USES_CUSTOM_TEXT
  726. */
  727. CARLA_EXPORT const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId, float value);
  728. /*!
  729. * Get a plugin's program name.
  730. * @param pluginId Plugin
  731. * @param programId Program index
  732. * @see carla_get_program_count()
  733. */
  734. CARLA_EXPORT const char* carla_get_program_name(uint pluginId, uint32_t programId);
  735. /*!
  736. * Get a plugin's MIDI program name.
  737. * @param pluginId Plugin
  738. * @param midiProgramId MIDI Program index
  739. * @see carla_get_midi_program_count()
  740. */
  741. CARLA_EXPORT const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId);
  742. /*!
  743. * Get a plugin's real name.\n
  744. * This is the name the plugin uses to identify itself; may not be unique.
  745. * @param pluginId Plugin
  746. */
  747. CARLA_EXPORT const char* carla_get_real_plugin_name(uint pluginId);
  748. /*!
  749. * Get a plugin's program index.
  750. * @param pluginId Plugin
  751. */
  752. CARLA_EXPORT int32_t carla_get_current_program_index(uint pluginId);
  753. /*!
  754. * Get a plugin's midi program index.
  755. * @param pluginId Plugin
  756. */
  757. CARLA_EXPORT int32_t carla_get_current_midi_program_index(uint pluginId);
  758. /*!
  759. * Get a plugin's default parameter value.
  760. * @param pluginId Plugin
  761. * @param parameterId Parameter index
  762. */
  763. CARLA_EXPORT float carla_get_default_parameter_value(uint pluginId, uint32_t parameterId);
  764. /*!
  765. * Get a plugin's current parameter value.
  766. * @param pluginId Plugin
  767. * @param parameterId Parameter index
  768. */
  769. CARLA_EXPORT float carla_get_current_parameter_value(uint pluginId, uint32_t parameterId);
  770. /*!
  771. * Get a plugin's input peak value.
  772. * @param pluginId Plugin
  773. * @param isLeft Wherever to get the left/mono value, otherwise right.
  774. */
  775. CARLA_EXPORT float carla_get_input_peak_value(uint pluginId, bool isLeft);
  776. /*!
  777. * Get a plugin's output peak value.
  778. * @param pluginId Plugin
  779. * @param isLeft Wherever to get the left/mono value, otherwise right.
  780. */
  781. CARLA_EXPORT float carla_get_output_peak_value(uint pluginId, bool isLeft);
  782. /*!
  783. * Enable a plugin's option.
  784. * @param pluginId Plugin
  785. * @param option An option from PluginOptions
  786. * @param yesNo New enabled state
  787. */
  788. CARLA_EXPORT void carla_set_option(uint pluginId, uint option, bool yesNo);
  789. /*!
  790. * Enable or disable a plugin.
  791. * @param pluginId Plugin
  792. * @param onOff New active state
  793. */
  794. CARLA_EXPORT void carla_set_active(uint pluginId, bool onOff);
  795. #ifndef BUILD_BRIDGE
  796. /*!
  797. * Change a plugin's internal dry/wet.
  798. * @param pluginId Plugin
  799. * @param value New dry/wet value
  800. */
  801. CARLA_EXPORT void carla_set_drywet(uint pluginId, float value);
  802. /*!
  803. * Change a plugin's internal volume.
  804. * @param pluginId Plugin
  805. * @param value New volume
  806. */
  807. CARLA_EXPORT void carla_set_volume(uint pluginId, float value);
  808. /*!
  809. * Change a plugin's internal stereo balance, left channel.
  810. * @param pluginId Plugin
  811. * @param value New value
  812. */
  813. CARLA_EXPORT void carla_set_balance_left(uint pluginId, float value);
  814. /*!
  815. * Change a plugin's internal stereo balance, right channel.
  816. * @param pluginId Plugin
  817. * @param value New value
  818. */
  819. CARLA_EXPORT void carla_set_balance_right(uint pluginId, float value);
  820. /*!
  821. * Change a plugin's internal mono panning value.
  822. * @param pluginId Plugin
  823. * @param value New value
  824. */
  825. CARLA_EXPORT void carla_set_panning(uint pluginId, float value);
  826. #endif
  827. /*!
  828. * Change a plugin's internal control channel.
  829. * @param pluginId Plugin
  830. * @param channel New channel
  831. */
  832. CARLA_EXPORT void carla_set_ctrl_channel(uint pluginId, int8_t channel);
  833. /*!
  834. * Change a plugin's parameter value.
  835. * @param pluginId Plugin
  836. * @param parameterId Parameter index
  837. * @param value New value
  838. */
  839. CARLA_EXPORT void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value);
  840. #ifndef BUILD_BRIDGE
  841. /*!
  842. * Change a plugin's parameter MIDI channel.
  843. * @param pluginId Plugin
  844. * @param parameterId Parameter index
  845. * @param channel New MIDI channel
  846. */
  847. CARLA_EXPORT void carla_set_parameter_midi_channel(uint pluginId, uint32_t parameterId, uint8_t channel);
  848. /*!
  849. * Change a plugin's parameter MIDI cc.
  850. * @param pluginId Plugin
  851. * @param parameterId Parameter index
  852. * @param cc New MIDI cc
  853. */
  854. CARLA_EXPORT void carla_set_parameter_midi_cc(uint pluginId, uint32_t parameterId, int16_t cc);
  855. #endif
  856. /*!
  857. * Change a plugin's current program.
  858. * @param pluginId Plugin
  859. * @param programId New program
  860. */
  861. CARLA_EXPORT void carla_set_program(uint pluginId, uint32_t programId);
  862. /*!
  863. * Change a plugin's current MIDI program.
  864. * @param pluginId Plugin
  865. * @param midiProgramId New value
  866. */
  867. CARLA_EXPORT void carla_set_midi_program(uint pluginId, uint32_t midiProgramId);
  868. /*!
  869. * Set a plugin's custom data set.
  870. * @param pluginId Plugin
  871. * @param type Type
  872. * @param key Key
  873. * @param value New value
  874. * @see CustomDataTypes and CustomDataKeys
  875. */
  876. CARLA_EXPORT void carla_set_custom_data(uint pluginId, const char* type, const char* key, const char* value);
  877. /*!
  878. * Set a plugin's chunk data.
  879. * @param pluginId Plugin
  880. * @param value New value
  881. * @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  882. */
  883. CARLA_EXPORT void carla_set_chunk_data(uint pluginId, const char* chunkData);
  884. /*!
  885. * Tell a plugin to prepare for save.\n
  886. * This should be called before saving custom data sets.
  887. * @param pluginId Plugin
  888. */
  889. CARLA_EXPORT void carla_prepare_for_save(uint pluginId);
  890. #ifndef BUILD_BRIDGE
  891. /*!
  892. * Send a single note of a plugin.\n
  893. * If velocity is 0, note-off is sent; note-on otherwise.
  894. * @param pluginId Plugin
  895. * @param channel Note channel
  896. * @param note Note pitch
  897. * @param velocity Note velocity
  898. */
  899. CARLA_EXPORT void carla_send_midi_note(uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity);
  900. #endif
  901. /*!
  902. * Tell a plugin to show its own custom UI.
  903. * @param pluginId Plugin
  904. * @param yesNo New UI state, visible or not
  905. * @see PLUGIN_HAS_CUSTOM_UI
  906. */
  907. CARLA_EXPORT void carla_show_custom_ui(uint pluginId, bool yesNo);
  908. /*!
  909. * Get the current engine buffer size.
  910. */
  911. CARLA_EXPORT uint32_t carla_get_buffer_size();
  912. /*!
  913. * Get the current engine sample rate.
  914. */
  915. CARLA_EXPORT double carla_get_sample_rate();
  916. /*!
  917. * Get the last error.
  918. */
  919. CARLA_EXPORT const char* carla_get_last_error();
  920. /*!
  921. * Get the current engine OSC URL (TCP).
  922. */
  923. CARLA_EXPORT const char* carla_get_host_osc_url_tcp();
  924. /*!
  925. * Get the current engine OSC URL (UDP).
  926. */
  927. CARLA_EXPORT const char* carla_get_host_osc_url_udp();
  928. /** @} */
  929. #endif /* CARLA_HOST_H_INCLUDED */