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.

1079 lines
26KB

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