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.

1042 lines
25KB

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