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.

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