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.

CarlaHost.h 27KB

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