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.

2030 lines
46KB

  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-2022 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_BACKEND_H_INCLUDED
  18. #define CARLA_BACKEND_H_INCLUDED
  19. #include "CarlaDefines.h"
  20. #ifdef CARLA_PROPER_CPP11_SUPPORT
  21. # include <cstdint>
  22. #else
  23. # include <stdint.h>
  24. #endif
  25. #define STR_MAX 0xFF
  26. #ifndef CARLA_BACKEND_NAMESPACE
  27. # define CARLA_BACKEND_NAMESPACE CarlaBackend
  28. #endif
  29. #ifdef __cplusplus
  30. # define CARLA_BACKEND_START_NAMESPACE namespace CARLA_BACKEND_NAMESPACE {
  31. # define CARLA_BACKEND_END_NAMESPACE }
  32. # define CARLA_BACKEND_USE_NAMESPACE using namespace CARLA_BACKEND_NAMESPACE;
  33. # include <algorithm>
  34. # include <cmath>
  35. # include <limits>
  36. /* Start namespace */
  37. CARLA_BACKEND_START_NAMESPACE
  38. #endif
  39. /*!
  40. * @defgroup CarlaBackendAPI Carla Backend API
  41. *
  42. * The Carla Backend API.
  43. *
  44. * These are the base definitions for everything in the Carla backend code.
  45. * @{
  46. */
  47. /* ------------------------------------------------------------------------------------------------------------
  48. * Carla Backend API (base definitions) */
  49. /*!
  50. * Maximum default number of loadable plugins.
  51. */
  52. static constexpr const uint MAX_DEFAULT_PLUGINS = 512;
  53. /*!
  54. * Maximum number of loadable plugins in rack mode.
  55. */
  56. static constexpr const uint MAX_RACK_PLUGINS = 64;
  57. /*!
  58. * Maximum number of loadable plugins in patchbay mode.
  59. */
  60. static constexpr const uint MAX_PATCHBAY_PLUGINS = 255;
  61. /*!
  62. * Maximum default number of parameters allowed.
  63. * @see ENGINE_OPTION_MAX_PARAMETERS
  64. */
  65. static constexpr const uint MAX_DEFAULT_PARAMETERS = 200;
  66. /*!
  67. * The "plugin Id" for the global Carla instance.
  68. * Currently only used for audio peaks.
  69. */
  70. static constexpr const uint MAIN_CARLA_PLUGIN_ID = 0xFFFF;
  71. /* ------------------------------------------------------------------------------------------------------------
  72. * Engine Driver Device Hints */
  73. /*!
  74. * @defgroup EngineDriverHints Engine Driver Device Hints
  75. *
  76. * Various engine driver device hints.
  77. * @see CarlaEngine::getHints(), CarlaEngine::getDriverDeviceInfo() and carla_get_engine_driver_device_info()
  78. * @{
  79. */
  80. /*!
  81. * Engine driver device has custom control-panel.
  82. */
  83. static constexpr const uint ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1;
  84. /*!
  85. * Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
  86. * @see ENGINE_OPTION_AUDIO_NUM_PERIODS
  87. */
  88. static constexpr const uint ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2;
  89. /*!
  90. * Engine driver device can change buffer-size on the fly.
  91. * @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
  92. */
  93. static constexpr const uint ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4;
  94. /*!
  95. * Engine driver device can change sample-rate on the fly.
  96. * @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
  97. */
  98. static constexpr const uint ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8;
  99. /** @} */
  100. /* ------------------------------------------------------------------------------------------------------------
  101. * Plugin Hints */
  102. /*!
  103. * @defgroup PluginHints Plugin Hints
  104. *
  105. * Various plugin hints.
  106. * @see CarlaPlugin::getHints() and carla_get_plugin_info()
  107. * @{
  108. */
  109. /*!
  110. * Plugin is a bridge.
  111. * This hint is required because "bridge" itself is not a plugin type.
  112. */
  113. static constexpr const uint PLUGIN_IS_BRIDGE = 0x001;
  114. /*!
  115. * Plugin is hard real-time safe.
  116. */
  117. static constexpr const uint PLUGIN_IS_RTSAFE = 0x002;
  118. /*!
  119. * Plugin is a synth (produces sound).
  120. */
  121. static constexpr const uint PLUGIN_IS_SYNTH = 0x004;
  122. /*!
  123. * Plugin has its own custom UI.
  124. * @see CarlaPlugin::showCustomUI() and carla_show_custom_ui()
  125. */
  126. static constexpr const uint PLUGIN_HAS_CUSTOM_UI = 0x008;
  127. /*!
  128. * Plugin can use internal Dry/Wet control.
  129. */
  130. static constexpr const uint PLUGIN_CAN_DRYWET = 0x010;
  131. /*!
  132. * Plugin can use internal Volume control.
  133. */
  134. static constexpr const uint PLUGIN_CAN_VOLUME = 0x020;
  135. /*!
  136. * Plugin can use internal (Stereo) Balance controls.
  137. */
  138. static constexpr const uint PLUGIN_CAN_BALANCE = 0x040;
  139. /*!
  140. * Plugin can use internal (Mono) Panning control.
  141. */
  142. static constexpr const uint PLUGIN_CAN_PANNING = 0x080;
  143. /*!
  144. * Plugin needs a constant, fixed-size audio buffer.
  145. */
  146. static constexpr const uint PLUGIN_NEEDS_FIXED_BUFFERS = 0x100;
  147. /*!
  148. * Plugin needs to receive all UI events in the main thread.
  149. */
  150. static constexpr const uint PLUGIN_NEEDS_UI_MAIN_THREAD = 0x200;
  151. /*!
  152. * Plugin uses 1 program per MIDI channel.
  153. * @note: Only used in some internal plugins and sf2 files.
  154. */
  155. static constexpr const uint PLUGIN_USES_MULTI_PROGS = 0x400;
  156. /*!
  157. * Plugin can make use of inline display API.
  158. */
  159. static constexpr const uint PLUGIN_HAS_INLINE_DISPLAY = 0x800;
  160. /*!
  161. * Plugin has its own custom UI which can be embed into another Window.
  162. * @see CarlaPlugin::embedCustomUI() and carla_embed_custom_ui()
  163. * @note This is very experimental and subject to change at this point
  164. */
  165. static constexpr const uint PLUGIN_HAS_CUSTOM_EMBED_UI = 0x1000;
  166. /*!
  167. * Plugin custom UI is a fake one that simply invokes an open file browser dialog.
  168. */
  169. static constexpr const uint PLUGIN_HAS_CUSTOM_UI_USING_FILE_OPEN = 0x2000;
  170. /*!
  171. * Plugin needs all idle events in the main thread.
  172. * @note Not possible on all engine implementations.
  173. */
  174. static constexpr const uint PLUGIN_NEEDS_MAIN_THREAD_IDLE = 0x4000;
  175. /*!
  176. * Plugin can use internal Front-Rear balance for Quadro (or > 2 channels in General).
  177. */
  178. static constexpr const uint PLUGIN_CAN_FORTH = 0x8000;
  179. /** @} */
  180. /* ------------------------------------------------------------------------------------------------------------
  181. * Plugin Options */
  182. /*!
  183. * @defgroup PluginOptions Plugin Options
  184. *
  185. * Various plugin options.
  186. * @note Do not modify these values, as they are saved as-is in project files.
  187. * @see CarlaPlugin::getOptionsAvailable(), CarlaPlugin::getOptionsEnabled(), carla_get_plugin_info() and carla_set_option()
  188. * @{
  189. */
  190. /*!
  191. * Use constant/fixed-size audio buffers.
  192. */
  193. static constexpr const uint PLUGIN_OPTION_FIXED_BUFFERS = 0x001;
  194. /*!
  195. * Force mono plugin as stereo.
  196. */
  197. static constexpr const uint PLUGIN_OPTION_FORCE_STEREO = 0x002;
  198. /*!
  199. * Map MIDI programs to plugin programs.
  200. */
  201. static constexpr const uint PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004;
  202. /*!
  203. * Use chunks to save and restore data instead of parameter values.
  204. */
  205. static constexpr const uint PLUGIN_OPTION_USE_CHUNKS = 0x008;
  206. /*!
  207. * Send MIDI control change events.
  208. */
  209. static constexpr const uint PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010;
  210. /*!
  211. * Send MIDI channel pressure events.
  212. */
  213. static constexpr const uint PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020;
  214. /*!
  215. * Send MIDI note after-touch events.
  216. */
  217. static constexpr const uint PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040;
  218. /*!
  219. * Send MIDI pitch-bend events.
  220. */
  221. static constexpr const uint PLUGIN_OPTION_SEND_PITCHBEND = 0x080;
  222. /*!
  223. * Send MIDI all-sounds/notes-off events, single note-offs otherwise.
  224. */
  225. static constexpr const uint PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100;
  226. /*!
  227. * Send MIDI bank/program changes.
  228. * @note: This option conflicts with PLUGIN_OPTION_MAP_PROGRAM_CHANGES and cannot be used at the same time.
  229. */
  230. static constexpr const uint PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200;
  231. /*!
  232. * Skip sending MIDI note events.
  233. * This if off-by-default as a way to keep backwards compatibility.
  234. * We always want notes enabled by default, not the contrary.
  235. */
  236. static constexpr const uint PLUGIN_OPTION_SKIP_SENDING_NOTES = 0x400;
  237. /*!
  238. * Special flag to indicate that plugin options are not yet set.
  239. * This flag exists because 0x0 as an option value is a valid one, so we need something else to indicate "null-ness".
  240. */
  241. static constexpr const uint PLUGIN_OPTIONS_NULL = 0x10000;
  242. /** @} */
  243. /* ------------------------------------------------------------------------------------------------------------
  244. * Audio Port Hints */
  245. /*!
  246. * @defgroup AudioPortHints Audio Port Hints
  247. *
  248. * Various audio port hints.
  249. * @see CarlaPlugin::getAudioPortHints() and carla_get_audio_port_hints()
  250. * @{
  251. */
  252. /*!
  253. * Audio port should be used as sidechan.
  254. */
  255. static constexpr const uint AUDIO_PORT_IS_SIDECHAIN = 0x1;
  256. /** @} */
  257. /* ------------------------------------------------------------------------------------------------------------
  258. * Parameter Hints */
  259. /*!
  260. * @defgroup ParameterHints Parameter Hints
  261. *
  262. * Various parameter hints.
  263. * @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
  264. * @{
  265. */
  266. /*!
  267. * Parameter value is boolean.
  268. * It's always at either minimum or maximum value.
  269. */
  270. static constexpr const uint PARAMETER_IS_BOOLEAN = 0x001;
  271. /*!
  272. * Parameter value is integer.
  273. */
  274. static constexpr const uint PARAMETER_IS_INTEGER = 0x002;
  275. /*!
  276. * Parameter value is logarithmic.
  277. */
  278. static constexpr const uint PARAMETER_IS_LOGARITHMIC = 0x004;
  279. /*!
  280. * Parameter is enabled.
  281. * It can be viewed, changed and stored.
  282. */
  283. static constexpr const uint PARAMETER_IS_ENABLED = 0x010;
  284. /*!
  285. * Parameter is automatable (real-time safe).
  286. */
  287. static constexpr const uint PARAMETER_IS_AUTOMATABLE = 0x020;
  288. /* for backwards compatibility */
  289. static constexpr const uint PARAMETER_IS_AUTOMABLE = 0x020;
  290. /*!
  291. * Parameter is read-only.
  292. * It cannot be changed.
  293. */
  294. static constexpr const uint PARAMETER_IS_READ_ONLY = 0x040;
  295. /*!
  296. * Parameter needs sample rate to work.
  297. * Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
  298. */
  299. static constexpr const uint PARAMETER_USES_SAMPLERATE = 0x100;
  300. /*!
  301. * Parameter uses scale points to define internal values in a meaningful way.
  302. */
  303. static constexpr const uint PARAMETER_USES_SCALEPOINTS = 0x200;
  304. /*!
  305. * Parameter uses custom text for displaying its value.
  306. * @see CarlaPlugin::getParameterText() and carla_get_parameter_text()
  307. */
  308. static constexpr const uint PARAMETER_USES_CUSTOM_TEXT = 0x400;
  309. /*!
  310. * Parameter can be turned into a CV control.
  311. */
  312. static constexpr const uint PARAMETER_CAN_BE_CV_CONTROLLED = 0x800;
  313. /*!
  314. * Parameter should not be saved as part of the project/session.
  315. * @note only valid for parameter inputs.
  316. */
  317. static constexpr const uint PARAMETER_IS_NOT_SAVED = 0x1000;
  318. /** @} */
  319. /* ------------------------------------------------------------------------------------------------------------
  320. * Mapped Parameter Flags */
  321. /*!
  322. * @defgroup MappedParameterFlags Mapped Parameter Flags
  323. *
  324. * Various flags for parameter mappings.
  325. * @see ParameterData::mappedFlags
  326. * @{
  327. */
  328. /*!
  329. * Parameter mapping uses delta value instead of full scale.
  330. * Only relevant for MIDI CC mappings.
  331. */
  332. static constexpr const uint PARAMETER_MAPPING_MIDI_DELTA = 0x001;
  333. /** @} */
  334. /* ------------------------------------------------------------------------------------------------------------
  335. * Patchbay Port Hints */
  336. /*!
  337. * @defgroup PatchbayPortHints Patchbay Port Hints
  338. *
  339. * Various patchbay port hints.
  340. * @{
  341. */
  342. /*!
  343. * Patchbay port is input.
  344. * When this hint is not set, port is assumed to be output.
  345. */
  346. static constexpr const uint PATCHBAY_PORT_IS_INPUT = 0x01;
  347. /*!
  348. * Patchbay port is of Audio type.
  349. */
  350. static constexpr const uint PATCHBAY_PORT_TYPE_AUDIO = 0x02;
  351. /*!
  352. * Patchbay port is of CV type (Control Voltage).
  353. */
  354. static constexpr const uint PATCHBAY_PORT_TYPE_CV = 0x04;
  355. /*!
  356. * Patchbay port is of MIDI type.
  357. */
  358. static constexpr const uint PATCHBAY_PORT_TYPE_MIDI = 0x08;
  359. /*!
  360. * Patchbay port is of OSC type.
  361. */
  362. static constexpr const uint PATCHBAY_PORT_TYPE_OSC = 0x10;
  363. /** @} */
  364. /* ------------------------------------------------------------------------------------------------------------
  365. * Patchbay Port Group Hints */
  366. /*!
  367. * @defgroup PatchbayPortGroupHints Patchbay Port Group Hints
  368. *
  369. * Various patchbay port group hints.
  370. * @{
  371. */
  372. /*!
  373. * Indicates that this group should be considered the "main" input.
  374. */
  375. static constexpr const uint PATCHBAY_PORT_GROUP_MAIN_INPUT = 0x01;
  376. /*!
  377. * Indicates that this group should be considered the "main" output.
  378. */
  379. static constexpr const uint PATCHBAY_PORT_GROUP_MAIN_OUTPUT = 0x02;
  380. /*!
  381. * A stereo port group, where the 1st port is left and the 2nd is right.
  382. */
  383. static constexpr const uint PATCHBAY_PORT_GROUP_STEREO = 0x04;
  384. /*!
  385. * A mid-side stereo group, where the 1st port is center and the 2nd is side.
  386. */
  387. static constexpr const uint PATCHBAY_PORT_GROUP_MID_SIDE = 0x08;
  388. /** @} */
  389. /* ------------------------------------------------------------------------------------------------------------
  390. * Custom Data Types */
  391. /*!
  392. * @defgroup CustomDataTypes Custom Data Types
  393. *
  394. * These types define how the value in the CustomData struct is stored.
  395. * @see CustomData::type
  396. * @{
  397. */
  398. /*!
  399. * Boolean string type URI.
  400. * Only "true" and "false" are valid values.
  401. */
  402. static constexpr const char* const CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean";
  403. /*!
  404. * Chunk type URI.
  405. */
  406. static constexpr const char* const CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk";
  407. /*!
  408. * Path type URI.
  409. */
  410. static constexpr const char* const CUSTOM_DATA_TYPE_PATH = "http://kxstudio.sf.net/ns/carla/path";
  411. /*!
  412. * Property type URI.
  413. */
  414. static constexpr const char* const CUSTOM_DATA_TYPE_PROPERTY = "http://kxstudio.sf.net/ns/carla/property";
  415. /*!
  416. * String type URI.
  417. */
  418. static constexpr const char* const CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string";
  419. /** @} */
  420. /* ------------------------------------------------------------------------------------------------------------
  421. * Custom Data Keys */
  422. /*!
  423. * @defgroup CustomDataKeys Custom Data Keys
  424. *
  425. * Pre-defined keys used internally in Carla.
  426. * @see CustomData::key
  427. * @{
  428. */
  429. /*!
  430. * UI position key.
  431. */
  432. static constexpr const char* const CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition";
  433. /*!
  434. * UI size key.
  435. */
  436. static constexpr const char* const CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize";
  437. /*!
  438. * UI visible key.
  439. */
  440. static constexpr const char* const CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible";
  441. /** @} */
  442. /* ------------------------------------------------------------------------------------------------------------
  443. * Binary Type */
  444. /*!
  445. * The binary type of a plugin.
  446. */
  447. typedef enum {
  448. /*!
  449. * Null binary type.
  450. */
  451. BINARY_NONE = 0,
  452. /*!
  453. * POSIX 32bit binary.
  454. */
  455. BINARY_POSIX32 = 1,
  456. /*!
  457. * POSIX 64bit binary.
  458. */
  459. BINARY_POSIX64 = 2,
  460. /*!
  461. * Windows 32bit binary.
  462. */
  463. BINARY_WIN32 = 3,
  464. /*!
  465. * Windows 64bit binary.
  466. */
  467. BINARY_WIN64 = 4,
  468. /*!
  469. * Other binary type.
  470. */
  471. BINARY_OTHER = 5
  472. } BinaryType;
  473. /* ------------------------------------------------------------------------------------------------------------
  474. * File Type */
  475. /*!
  476. * File type.
  477. */
  478. typedef enum {
  479. /*!
  480. * Null file type.
  481. */
  482. FILE_NONE = 0,
  483. /*!
  484. * Audio file.
  485. */
  486. FILE_AUDIO = 1,
  487. /*!
  488. * MIDI file.
  489. */
  490. FILE_MIDI = 2
  491. } FileType;
  492. /* ------------------------------------------------------------------------------------------------------------
  493. * Plugin Type */
  494. /*!
  495. * Plugin type.
  496. * Some files are handled as if they were plugins.
  497. */
  498. typedef enum {
  499. /*!
  500. * Null plugin type.
  501. */
  502. PLUGIN_NONE = 0,
  503. /*!
  504. * Internal plugin.
  505. */
  506. PLUGIN_INTERNAL = 1,
  507. /*!
  508. * LADSPA plugin.
  509. */
  510. PLUGIN_LADSPA = 2,
  511. /*!
  512. * DSSI plugin.
  513. */
  514. PLUGIN_DSSI = 3,
  515. /*!
  516. * LV2 plugin.
  517. */
  518. PLUGIN_LV2 = 4,
  519. /*!
  520. * VST2 plugin.
  521. */
  522. PLUGIN_VST2 = 5,
  523. /*!
  524. * VST3 plugin.
  525. */
  526. PLUGIN_VST3 = 6,
  527. /*!
  528. * AU plugin.
  529. * @note MacOS only
  530. */
  531. PLUGIN_AU = 7,
  532. /*!
  533. * DLS file.
  534. */
  535. PLUGIN_DLS = 8,
  536. /*!
  537. * GIG file.
  538. */
  539. PLUGIN_GIG = 9,
  540. /*!
  541. * SF2/3 file (SoundFont).
  542. */
  543. PLUGIN_SF2 = 10,
  544. /*!
  545. * SFZ file.
  546. */
  547. PLUGIN_SFZ = 11,
  548. /*!
  549. * JACK application.
  550. */
  551. PLUGIN_JACK = 12,
  552. /*!
  553. * JSFX plugin.
  554. */
  555. PLUGIN_JSFX = 13,
  556. /*!
  557. * CLAP plugin.
  558. */
  559. PLUGIN_CLAP = 14,
  560. /*!
  561. * Terminator/count, not a plugin type.
  562. */
  563. PLUGIN_TYPE_COUNT = 15
  564. } PluginType;
  565. /* ------------------------------------------------------------------------------------------------------------
  566. * Plugin Category */
  567. /*!
  568. * Plugin category, which describes the functionality of a plugin.
  569. */
  570. typedef enum {
  571. /*!
  572. * Null plugin category.
  573. */
  574. PLUGIN_CATEGORY_NONE = 0,
  575. /*!
  576. * A synthesizer or generator.
  577. */
  578. PLUGIN_CATEGORY_SYNTH = 1,
  579. /*!
  580. * A delay or reverb.
  581. */
  582. PLUGIN_CATEGORY_DELAY = 2,
  583. /*!
  584. * An equalizer.
  585. */
  586. PLUGIN_CATEGORY_EQ = 3,
  587. /*!
  588. * A filter.
  589. */
  590. PLUGIN_CATEGORY_FILTER = 4,
  591. /*!
  592. * A distortion plugin.
  593. */
  594. PLUGIN_CATEGORY_DISTORTION = 5,
  595. /*!
  596. * A 'dynamic' plugin (amplifier, compressor, gate, etc).
  597. */
  598. PLUGIN_CATEGORY_DYNAMICS = 6,
  599. /*!
  600. * A 'modulator' plugin (chorus, flanger, phaser, etc).
  601. */
  602. PLUGIN_CATEGORY_MODULATOR = 7,
  603. /*!
  604. * An 'utility' plugin (analyzer, converter, mixer, etc).
  605. */
  606. PLUGIN_CATEGORY_UTILITY = 8,
  607. /*!
  608. * Miscellaneous plugin (used to check if the plugin has a category).
  609. */
  610. PLUGIN_CATEGORY_OTHER = 9
  611. } PluginCategory;
  612. /* ------------------------------------------------------------------------------------------------------------
  613. * Parameter Type */
  614. /*!
  615. * Plugin parameter type.
  616. */
  617. typedef enum {
  618. /*!
  619. * Null parameter type.
  620. */
  621. PARAMETER_UNKNOWN = 0,
  622. /*!
  623. * Input parameter.
  624. */
  625. PARAMETER_INPUT = 1,
  626. /*!
  627. * Output parameter.
  628. */
  629. PARAMETER_OUTPUT = 2
  630. } ParameterType;
  631. /* ------------------------------------------------------------------------------------------------------------
  632. * Internal Parameter Index */
  633. /*!
  634. * Special parameters used internally in Carla.
  635. * Plugins do not know about their existence.
  636. */
  637. typedef enum {
  638. /*!
  639. * Null parameter.
  640. */
  641. PARAMETER_NULL = -1,
  642. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  643. /*!
  644. * Active parameter, boolean type.
  645. * Default is 'false'.
  646. */
  647. PARAMETER_ACTIVE = -2,
  648. /*!
  649. * Dry/Wet parameter.
  650. * Range 0.0...1.0; default is 1.0.
  651. */
  652. PARAMETER_DRYWET = -3,
  653. /*!
  654. * Volume parameter.
  655. * Range 0.0...1.27; default is 1.0.
  656. */
  657. PARAMETER_VOLUME = -4,
  658. /*!
  659. * Stereo Balance-Left parameter.
  660. * Range -1.0...1.0; default is -1.0.
  661. */
  662. PARAMETER_BALANCE_LEFT = -5,
  663. /*!
  664. * Stereo Balance-Right parameter.
  665. * Range -1.0...1.0; default is 1.0.
  666. */
  667. PARAMETER_BALANCE_RIGHT = -6,
  668. /*!
  669. * Mono Panning parameter.
  670. * Range -1.0...1.0; default is 0.0.
  671. */
  672. PARAMETER_PANNING = -7,
  673. /*!
  674. * MIDI Control channel, integer type.
  675. * Range -1...15 (-1 = off).
  676. */
  677. PARAMETER_CTRL_CHANNEL = -8,
  678. /*!
  679. * Experimental Front-Rear parameter for Quadro (or > 2 channels in General).
  680. * Range -1.0...1.0; default is 0.0.
  681. */
  682. PARAMETER_FORTH = -9,
  683. #endif
  684. /*!
  685. * Max value, defined only for convenience.
  686. */
  687. PARAMETER_MAX = -10
  688. } InternalParameterIndex;
  689. /* ------------------------------------------------------------------------------------------------------------
  690. * Special Mapped Control Index */
  691. /*!
  692. * Specially designated mapped control indexes.
  693. * Values between 0 and 119 (0x77) are reserved for MIDI CC, which uses direct values.
  694. * @see ParameterData::mappedControlIndex
  695. */
  696. typedef enum {
  697. /*!
  698. * Unused control index, meaning no mapping is enabled.
  699. */
  700. CONTROL_INDEX_NONE = -1,
  701. /*!
  702. * CV control index, meaning the parameter is exposed as CV port.
  703. */
  704. CONTROL_INDEX_CV = 130,
  705. /*!
  706. * Special value to indicate MIDI pitchbend.
  707. */
  708. CONTROL_INDEX_MIDI_PITCHBEND = 131,
  709. /*!
  710. * Special value to indicate MIDI learn.
  711. */
  712. CONTROL_INDEX_MIDI_LEARN = 132,
  713. /*!
  714. * Highest index allowed for mappings.
  715. */
  716. CONTROL_INDEX_MAX_ALLOWED = CONTROL_INDEX_MIDI_LEARN
  717. } SpecialMappedControlIndex;
  718. /* ------------------------------------------------------------------------------------------------------------
  719. * Engine Callback Opcode */
  720. /*!
  721. * Engine callback opcodes.
  722. * Front-ends must never block indefinitely during a callback.
  723. * @see EngineCallbackFunc, CarlaEngine::setCallback() and carla_set_engine_callback()
  724. */
  725. typedef enum {
  726. /*!
  727. * Debug.
  728. * This opcode is undefined and used only for testing purposes.
  729. */
  730. ENGINE_CALLBACK_DEBUG = 0,
  731. /*!
  732. * A plugin has been added.
  733. * @a pluginId Plugin Id
  734. * @a value1 Plugin type
  735. * @a valueStr Plugin name
  736. */
  737. ENGINE_CALLBACK_PLUGIN_ADDED = 1,
  738. /*!
  739. * A plugin has been removed.
  740. * @a pluginId Plugin Id
  741. */
  742. ENGINE_CALLBACK_PLUGIN_REMOVED = 2,
  743. /*!
  744. * A plugin has been renamed.
  745. * @a pluginId Plugin Id
  746. * @a valueStr New plugin name
  747. */
  748. ENGINE_CALLBACK_PLUGIN_RENAMED = 3,
  749. /*!
  750. * A plugin has become unavailable.
  751. * @a pluginId Plugin Id
  752. * @a valueStr Related error string
  753. */
  754. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4,
  755. /*!
  756. * A parameter value has changed.
  757. * @a pluginId Plugin Id
  758. * @a value1 Parameter index
  759. * @a valuef New parameter value
  760. */
  761. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5,
  762. /*!
  763. * A parameter default has changed.
  764. * @a pluginId Plugin Id
  765. * @a value1 Parameter index
  766. * @a valuef New default value
  767. */
  768. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6,
  769. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  770. /*!
  771. * A parameter's mapped control index has changed.
  772. * @a pluginId Plugin Id
  773. * @a value1 Parameter index
  774. * @a value2 New control index
  775. */
  776. ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED = 7,
  777. /*!
  778. * A parameter's MIDI channel has changed.
  779. * @a pluginId Plugin Id
  780. * @a value1 Parameter index
  781. * @a value2 New MIDI channel
  782. */
  783. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8,
  784. /*!
  785. * A plugin option has changed.
  786. * @a pluginId Plugin Id
  787. * @a value1 Option
  788. * @a value2 New on/off state (1 for on, 0 for off)
  789. * @see PluginOptions
  790. */
  791. ENGINE_CALLBACK_OPTION_CHANGED = 9,
  792. #endif
  793. /*!
  794. * The current program of a plugin has changed.
  795. * @a pluginId Plugin Id
  796. * @a value1 New program index
  797. */
  798. ENGINE_CALLBACK_PROGRAM_CHANGED = 10,
  799. /*!
  800. * The current MIDI program of a plugin has changed.
  801. * @a pluginId Plugin Id
  802. * @a value1 New MIDI program index
  803. */
  804. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11,
  805. /*!
  806. * A plugin's custom UI state has changed.
  807. * @a pluginId Plugin Id
  808. * @a value1 New state, as follows:
  809. * 0: UI is now hidden
  810. * 1: UI is now visible
  811. * -1: UI has crashed and should not be shown again
  812. */
  813. ENGINE_CALLBACK_UI_STATE_CHANGED = 12,
  814. /*!
  815. * A note has been pressed.
  816. * @a pluginId Plugin Id
  817. * @a value1 Channel
  818. * @a value2 Note
  819. * @a value3 Velocity
  820. */
  821. ENGINE_CALLBACK_NOTE_ON = 13,
  822. /*!
  823. * A note has been released.
  824. * @a pluginId Plugin Id
  825. * @a value1 Channel
  826. * @a value2 Note
  827. */
  828. ENGINE_CALLBACK_NOTE_OFF = 14,
  829. /*!
  830. * A plugin needs update.
  831. * @a pluginId Plugin Id
  832. */
  833. ENGINE_CALLBACK_UPDATE = 15,
  834. /*!
  835. * A plugin's data/information has changed.
  836. * @a pluginId Plugin Id
  837. */
  838. ENGINE_CALLBACK_RELOAD_INFO = 16,
  839. /*!
  840. * A plugin's parameters have changed.
  841. * @a pluginId Plugin Id
  842. */
  843. ENGINE_CALLBACK_RELOAD_PARAMETERS = 17,
  844. /*!
  845. * A plugin's programs have changed.
  846. * @a pluginId Plugin Id
  847. */
  848. ENGINE_CALLBACK_RELOAD_PROGRAMS = 18,
  849. /*!
  850. * A plugin state has changed.
  851. * @a pluginId Plugin Id
  852. */
  853. ENGINE_CALLBACK_RELOAD_ALL = 19,
  854. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  855. /*!
  856. * A patchbay client has been added.
  857. * @a pluginId Client Id
  858. * @a value1 Client icon
  859. * @a value2 Plugin Id (-1 if not a plugin)
  860. * @a valueStr Client name
  861. * @see PatchbayIcon
  862. */
  863. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20,
  864. /*!
  865. * A patchbay client has been removed.
  866. * @a pluginId Client Id
  867. */
  868. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21,
  869. /*!
  870. * A patchbay client has been renamed.
  871. * @a pluginId Client Id
  872. * @a valueStr New client name
  873. */
  874. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22,
  875. /*!
  876. * A patchbay client data has changed.
  877. * @a pluginId Client Id
  878. * @a value1 New icon
  879. * @a value2 New plugin Id (-1 if not a plugin)
  880. * @see PatchbayIcon
  881. */
  882. ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23,
  883. /*!
  884. * A patchbay port has been added.
  885. * @a pluginId Client Id
  886. * @a value1 Port Id
  887. * @a value2 Port hints
  888. * @a value3 Port group Id (0 for none)
  889. * @a valueStr Port name
  890. * @see PatchbayPortHints
  891. */
  892. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24,
  893. /*!
  894. * A patchbay port has been removed.
  895. * @a pluginId Client Id
  896. * @a value1 Port Id
  897. */
  898. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25,
  899. /*!
  900. * A patchbay port has changed (like the name or group Id).
  901. * @a pluginId Client Id
  902. * @a value1 Port Id
  903. * @a value2 Port hints
  904. * @a value3 Port group Id (0 for none)
  905. * @a valueStr Port name
  906. */
  907. ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED = 26,
  908. /*!
  909. * A patchbay connection has been added.
  910. * @a pluginId Connection Id
  911. * @a valueStr Out group and port plus in group and port, in "og:op:ig:ip" syntax.
  912. */
  913. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27,
  914. /*!
  915. * A patchbay connection has been removed.
  916. * @a pluginId Connection Id
  917. */
  918. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28,
  919. #endif
  920. /*!
  921. * Engine started.
  922. * @a pluginId How many plugins are known to be running
  923. * @a value1 Process mode
  924. * @a value2 Transport mode
  925. * @a value3 Buffer size
  926. * @a valuef Sample rate
  927. * @a valuestr Engine driver
  928. * @see EngineProcessMode
  929. * @see EngineTransportMode
  930. */
  931. ENGINE_CALLBACK_ENGINE_STARTED = 29,
  932. /*!
  933. * Engine stopped.
  934. */
  935. ENGINE_CALLBACK_ENGINE_STOPPED = 30,
  936. /*!
  937. * Engine process mode has changed.
  938. * @a value1 New process mode
  939. * @see EngineProcessMode
  940. */
  941. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31,
  942. /*!
  943. * Engine transport mode has changed.
  944. * @a value1 New transport mode
  945. * @a valueStr New transport features enabled
  946. * @see EngineTransportMode
  947. */
  948. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32,
  949. /*!
  950. * Engine buffer-size changed.
  951. * @a value1 New buffer size
  952. */
  953. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33,
  954. /*!
  955. * Engine sample-rate changed.
  956. * @a valuef New sample rate
  957. */
  958. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34,
  959. /*!
  960. * A cancelable action has been started or stopped.
  961. * @a pluginId Plugin Id the action relates to, -1 for none
  962. * @a value1 1 for action started, 0 for stopped
  963. * @a valueStr Action name
  964. */
  965. ENGINE_CALLBACK_CANCELABLE_ACTION = 35,
  966. /*!
  967. * Project has finished loading.
  968. */
  969. ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36,
  970. /*!
  971. * NSM callback, to be handled by a frontend.
  972. * Frontend must call carla_nsm_ready() with opcode as parameter as a response
  973. * @a value1 NSM opcode
  974. * @a value2 Integer value
  975. * @a valueStr String value
  976. * @see NsmCallbackOpcode
  977. */
  978. ENGINE_CALLBACK_NSM = 37,
  979. /*!
  980. * Idle frontend.
  981. * This is used by the engine during long operations that might block the frontend,
  982. * giving it the possibility to idle while the operation is still in place.
  983. */
  984. ENGINE_CALLBACK_IDLE = 38,
  985. /*!
  986. * Show a message as information.
  987. * @a valueStr The message
  988. */
  989. ENGINE_CALLBACK_INFO = 39,
  990. /*!
  991. * Show a message as an error.
  992. * @a valueStr The message
  993. */
  994. ENGINE_CALLBACK_ERROR = 40,
  995. /*!
  996. * The engine has crashed or malfunctioned and will no longer work.
  997. */
  998. ENGINE_CALLBACK_QUIT = 41,
  999. /*!
  1000. * A plugin requested for its inline display to be redrawn.
  1001. * @a pluginId Plugin Id to redraw
  1002. */
  1003. ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW = 42,
  1004. /*!
  1005. * A patchbay port group has been added.
  1006. * @a pluginId Client Id
  1007. * @a value1 Group Id (unique value within this client)
  1008. * @a value2 Group hints
  1009. * @a valueStr Group name
  1010. * @see PatchbayPortGroupHints
  1011. */
  1012. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED = 43,
  1013. /*!
  1014. * A patchbay port group has been removed.
  1015. * @a pluginId Client Id
  1016. * @a value1 Group Id
  1017. */
  1018. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED = 44,
  1019. /*!
  1020. * A patchbay port group has changed.
  1021. * @a pluginId Client Id
  1022. * @a value1 Group Id
  1023. * @a value2 Group hints
  1024. * @a valueStr Group name
  1025. * @see PatchbayPortGroupHints
  1026. */
  1027. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED = 45,
  1028. /*!
  1029. * A parameter's mapped range has changed.
  1030. * @a pluginId Plugin Id
  1031. * @a value1 Parameter index
  1032. * @a valueStr New mapped range as "%f:%f" syntax
  1033. */
  1034. ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED = 46,
  1035. /*!
  1036. * A patchbay client position has changed.
  1037. * @a pluginId Client Id
  1038. * @a value1 X position 1
  1039. * @a value2 Y position 1
  1040. * @a value3 X position 2
  1041. * @a valuef Y position 2
  1042. */
  1043. ENGINE_CALLBACK_PATCHBAY_CLIENT_POSITION_CHANGED = 47,
  1044. /*!
  1045. * A plugin embed UI has been resized.
  1046. * @a pluginId Plugin Id to resize
  1047. * @a value1 New width
  1048. * @a value2 New height
  1049. */
  1050. ENGINE_CALLBACK_EMBED_UI_RESIZED = 48
  1051. } EngineCallbackOpcode;
  1052. /* ------------------------------------------------------------------------------------------------------------
  1053. * NSM Callback Opcode */
  1054. /*!
  1055. * NSM callback opcodes.
  1056. * @see ENGINE_CALLBACK_NSM
  1057. */
  1058. typedef enum {
  1059. /*!
  1060. * NSM is available and initialized.
  1061. */
  1062. NSM_CALLBACK_INIT = 0,
  1063. /*!
  1064. * Error from NSM side.
  1065. * @a valueInt Error code
  1066. * @a valueStr Error string
  1067. */
  1068. NSM_CALLBACK_ERROR = 1,
  1069. /*!
  1070. * Announce message.
  1071. * @a valueInt SM Flags (WIP, to be defined)
  1072. * @a valueStr SM Name
  1073. */
  1074. NSM_CALLBACK_ANNOUNCE = 2,
  1075. /*!
  1076. * Open message.
  1077. * @a valueStr Project filename
  1078. */
  1079. NSM_CALLBACK_OPEN = 3,
  1080. /*!
  1081. * Save message.
  1082. */
  1083. NSM_CALLBACK_SAVE = 4,
  1084. /*!
  1085. * Session-is-loaded message.
  1086. */
  1087. NSM_CALLBACK_SESSION_IS_LOADED = 5,
  1088. /*!
  1089. * Show-optional-gui message.
  1090. */
  1091. NSM_CALLBACK_SHOW_OPTIONAL_GUI = 6,
  1092. /*!
  1093. * Hide-optional-gui message.
  1094. */
  1095. NSM_CALLBACK_HIDE_OPTIONAL_GUI = 7,
  1096. /*!
  1097. * Set client name id message.
  1098. */
  1099. NSM_CALLBACK_SET_CLIENT_NAME_ID = 8
  1100. } NsmCallbackOpcode;
  1101. /* ------------------------------------------------------------------------------------------------------------
  1102. * Engine Option */
  1103. /*!
  1104. * Engine options.
  1105. * @see CarlaEngine::getOptions(), CarlaEngine::setOption() and carla_set_engine_option()
  1106. */
  1107. typedef enum {
  1108. /*!
  1109. * Debug.
  1110. * This option is undefined and used only for testing purposes.
  1111. */
  1112. ENGINE_OPTION_DEBUG = 0,
  1113. /*!
  1114. * Set the engine processing mode.
  1115. * Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_PATCHBAY for all other OSes.
  1116. * @see EngineProcessMode
  1117. */
  1118. ENGINE_OPTION_PROCESS_MODE = 1,
  1119. /*!
  1120. * Set the engine transport mode.
  1121. * Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  1122. * @see EngineTransportMode
  1123. */
  1124. ENGINE_OPTION_TRANSPORT_MODE = 2,
  1125. /*!
  1126. * Force mono plugins as stereo, by running 2 instances at the same time.
  1127. * Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  1128. * @note Not supported by all plugins
  1129. * @see PLUGIN_OPTION_FORCE_STEREO
  1130. */
  1131. ENGINE_OPTION_FORCE_STEREO = 3,
  1132. /*!
  1133. * Use plugin bridges whenever possible.
  1134. * Default is no, EXPERIMENTAL.
  1135. */
  1136. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4,
  1137. /*!
  1138. * Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  1139. * Default is yes.
  1140. */
  1141. ENGINE_OPTION_PREFER_UI_BRIDGES = 5,
  1142. /*!
  1143. * Make custom plugin UIs always-on-top.
  1144. * Default is yes.
  1145. */
  1146. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6,
  1147. /*!
  1148. * Maximum number of parameters allowed.
  1149. * Default is MAX_DEFAULT_PARAMETERS.
  1150. */
  1151. ENGINE_OPTION_MAX_PARAMETERS = 7,
  1152. /*!
  1153. * Reset Xrun counter after project load.
  1154. */
  1155. ENGINE_OPTION_RESET_XRUNS = 8,
  1156. /*!
  1157. * Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  1158. * Default is 4000 (4 seconds).
  1159. */
  1160. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 9,
  1161. /*!
  1162. * Audio buffer size.
  1163. * Default is 512.
  1164. */
  1165. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10,
  1166. /*!
  1167. * Audio sample rate.
  1168. * Default is 44100.
  1169. */
  1170. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11,
  1171. /*!
  1172. * Wherever to use 3 audio periods instead of the default 2.
  1173. * Default is false.
  1174. */
  1175. ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 12,
  1176. /*!
  1177. * Audio driver.
  1178. * Default depends on platform.
  1179. */
  1180. ENGINE_OPTION_AUDIO_DRIVER = 13,
  1181. /*!
  1182. * Audio device (within a driver).
  1183. * Default unset.
  1184. */
  1185. ENGINE_OPTION_AUDIO_DEVICE = 14,
  1186. #ifndef BUILD_BRIDGE
  1187. /*!
  1188. * Wherever to enable OSC support in the engine.
  1189. */
  1190. ENGINE_OPTION_OSC_ENABLED = 15,
  1191. /*!
  1192. * The network TCP port to use for OSC.
  1193. * A value of 0 means use a random port.
  1194. * A value of < 0 means to not enable the TCP port for OSC.
  1195. * @note Valid ports begin at 1024 and end at 32767 (inclusive)
  1196. */
  1197. ENGINE_OPTION_OSC_PORT_TCP = 16,
  1198. /*!
  1199. * The network UDP port to use for OSC.
  1200. * A value of 0 means use a random port.
  1201. * A value of < 0 means to not enable the UDP port for OSC.
  1202. * @note Disabling this option prevents DSSI UIs from working!
  1203. * @note Valid ports begin at 1024 and end at 32767 (inclusive)
  1204. */
  1205. ENGINE_OPTION_OSC_PORT_UDP = 17,
  1206. #endif
  1207. /*!
  1208. * Set path used for a specific file type.
  1209. * Uses value as the file format, valueStr as actual path.
  1210. */
  1211. ENGINE_OPTION_FILE_PATH = 18,
  1212. /*!
  1213. * Set path used for a specific plugin type.
  1214. * Uses value as the plugin format, valueStr as actual path.
  1215. * @see PluginType
  1216. */
  1217. ENGINE_OPTION_PLUGIN_PATH = 19,
  1218. /*!
  1219. * Set path to the binary files.
  1220. * Default unset.
  1221. * @note Must be set for plugin and UI bridges to work
  1222. */
  1223. ENGINE_OPTION_PATH_BINARIES = 20,
  1224. /*!
  1225. * Set path to the resource files.
  1226. * Default unset.
  1227. * @note Must be set for some internal plugins to work
  1228. */
  1229. ENGINE_OPTION_PATH_RESOURCES = 21,
  1230. /*!
  1231. * Prevent bad plugin and UI behaviour.
  1232. * @note: Linux only
  1233. */
  1234. ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 22,
  1235. /*!
  1236. * Set background color used in the frontend, so backend can do the same for plugin UIs.
  1237. */
  1238. ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR = 23,
  1239. /*!
  1240. * Set foreground color used in the frontend, so backend can do the same for plugin UIs.
  1241. */
  1242. ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR = 24,
  1243. /*!
  1244. * Set UI scaling used in the frontend, so backend can do the same for plugin UIs.
  1245. */
  1246. ENGINE_OPTION_FRONTEND_UI_SCALE = 25,
  1247. /*!
  1248. * Set frontend winId, used to define as parent window for plugin UIs.
  1249. */
  1250. ENGINE_OPTION_FRONTEND_WIN_ID = 26,
  1251. #if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
  1252. /*!
  1253. * Set path to wine executable.
  1254. */
  1255. ENGINE_OPTION_WINE_EXECUTABLE = 27,
  1256. /*!
  1257. * Enable automatic wineprefix detection.
  1258. */
  1259. ENGINE_OPTION_WINE_AUTO_PREFIX = 28,
  1260. /*!
  1261. * Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
  1262. */
  1263. ENGINE_OPTION_WINE_FALLBACK_PREFIX = 29,
  1264. /*!
  1265. * Enable realtime priority for Wine application and server threads.
  1266. */
  1267. ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 30,
  1268. /*!
  1269. * Base realtime priority for Wine threads.
  1270. */
  1271. ENGINE_OPTION_WINE_BASE_RT_PRIO = 31,
  1272. /*!
  1273. * Wine server realtime priority.
  1274. */
  1275. ENGINE_OPTION_WINE_SERVER_RT_PRIO = 32,
  1276. #endif
  1277. #ifndef BUILD_BRIDGE
  1278. /*!
  1279. * Capture console output into debug callbacks.
  1280. */
  1281. ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33,
  1282. #endif
  1283. /*!
  1284. * A prefix to give to all plugin clients created by Carla.
  1285. * Mostly useful for JACK multi-client mode.
  1286. * @note MUST include at least one "." (dot).
  1287. */
  1288. ENGINE_OPTION_CLIENT_NAME_PREFIX = 34,
  1289. /*!
  1290. * Treat loaded plugins as standalone (that is, there is no host UI to manage them)
  1291. */
  1292. ENGINE_OPTION_PLUGINS_ARE_STANDALONE = 35
  1293. } EngineOption;
  1294. /* ------------------------------------------------------------------------------------------------------------
  1295. * Engine Process Mode */
  1296. /*!
  1297. * Engine process mode.
  1298. * @see ENGINE_OPTION_PROCESS_MODE
  1299. */
  1300. typedef enum {
  1301. /*!
  1302. * Single client mode.
  1303. * Inputs and outputs are added dynamically as needed by plugins.
  1304. */
  1305. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0,
  1306. /*!
  1307. * Multiple client mode.
  1308. * It has 1 master client + 1 client per plugin.
  1309. */
  1310. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1,
  1311. /*!
  1312. * Single client, 'rack' mode.
  1313. * Processes plugins in order of Id, with forced stereo always on.
  1314. */
  1315. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2,
  1316. /*!
  1317. * Single client, 'patchbay' mode.
  1318. */
  1319. ENGINE_PROCESS_MODE_PATCHBAY = 3,
  1320. /*!
  1321. * Special mode, used in plugin-bridges only.
  1322. */
  1323. ENGINE_PROCESS_MODE_BRIDGE = 4
  1324. } EngineProcessMode;
  1325. /* ------------------------------------------------------------------------------------------------------------
  1326. * Engine Transport Mode */
  1327. /*!
  1328. * Engine transport mode.
  1329. * @see ENGINE_OPTION_TRANSPORT_MODE
  1330. */
  1331. typedef enum {
  1332. /*!
  1333. * No transport.
  1334. */
  1335. ENGINE_TRANSPORT_MODE_DISABLED = 0,
  1336. /*!
  1337. * Internal transport mode.
  1338. */
  1339. ENGINE_TRANSPORT_MODE_INTERNAL = 1,
  1340. /*!
  1341. * Transport from JACK.
  1342. * Only available if driver name is "JACK".
  1343. */
  1344. ENGINE_TRANSPORT_MODE_JACK = 2,
  1345. /*!
  1346. * Transport from host, used when Carla is a plugin.
  1347. */
  1348. ENGINE_TRANSPORT_MODE_PLUGIN = 3,
  1349. /*!
  1350. * Special mode, used in plugin-bridges only.
  1351. */
  1352. ENGINE_TRANSPORT_MODE_BRIDGE = 4
  1353. } EngineTransportMode;
  1354. /* ------------------------------------------------------------------------------------------------------------
  1355. * File Callback Opcode */
  1356. /*!
  1357. * File callback opcodes.
  1358. * Front-ends must always block-wait for user input.
  1359. * @see FileCallbackFunc, CarlaEngine::setFileCallback() and carla_set_file_callback()
  1360. */
  1361. typedef enum {
  1362. /*!
  1363. * Debug.
  1364. * This opcode is undefined and used only for testing purposes.
  1365. */
  1366. FILE_CALLBACK_DEBUG = 0,
  1367. /*!
  1368. * Open file or folder.
  1369. */
  1370. FILE_CALLBACK_OPEN = 1,
  1371. /*!
  1372. * Save file or folder.
  1373. */
  1374. FILE_CALLBACK_SAVE = 2
  1375. } FileCallbackOpcode;
  1376. /* ------------------------------------------------------------------------------------------------------------
  1377. * Patchbay Icon */
  1378. /*!
  1379. * The icon of a patchbay client/group.
  1380. */
  1381. enum PatchbayIcon {
  1382. /*!
  1383. * Generic application icon.
  1384. * Used for all non-plugin clients that don't have a specific icon.
  1385. */
  1386. PATCHBAY_ICON_APPLICATION = 0,
  1387. /*!
  1388. * Plugin icon.
  1389. * Used for all plugin clients that don't have a specific icon.
  1390. */
  1391. PATCHBAY_ICON_PLUGIN = 1,
  1392. /*!
  1393. * Hardware icon.
  1394. * Used for hardware (audio or MIDI) clients.
  1395. */
  1396. PATCHBAY_ICON_HARDWARE = 2,
  1397. /*!
  1398. * Carla icon.
  1399. * Used for the main app.
  1400. */
  1401. PATCHBAY_ICON_CARLA = 3,
  1402. /*!
  1403. * DISTRHO icon.
  1404. * Used for DISTRHO based plugins.
  1405. */
  1406. PATCHBAY_ICON_DISTRHO = 4,
  1407. /*!
  1408. * File icon.
  1409. * Used for file type plugins (like SF2 snd SFZ).
  1410. */
  1411. PATCHBAY_ICON_FILE = 5
  1412. };
  1413. /* ------------------------------------------------------------------------------------------------------------
  1414. * Carla Backend API (C stuff) */
  1415. /*!
  1416. * Engine callback function.
  1417. * Front-ends must never block indefinitely during a callback.
  1418. * @see EngineCallbackOpcode, CarlaEngine::setCallback() and carla_set_engine_callback()
  1419. */
  1420. typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackOpcode action, uint pluginId,
  1421. int value1, int value2, int value3,
  1422. float valuef, const char* valueStr);
  1423. /*!
  1424. * File callback function.
  1425. * @see FileCallbackOpcode
  1426. */
  1427. typedef const char* (*FileCallbackFunc)(void* ptr, FileCallbackOpcode action, bool isDir, const char* title, const char* filter);
  1428. /*!
  1429. * Parameter data.
  1430. */
  1431. typedef struct {
  1432. /*!
  1433. * This parameter type.
  1434. */
  1435. ParameterType type;
  1436. /*!
  1437. * This parameter hints.
  1438. * @see ParameterHints
  1439. */
  1440. uint hints;
  1441. /*!
  1442. * Index as seen by Carla.
  1443. */
  1444. int32_t index;
  1445. /*!
  1446. * Real index as seen by plugins.
  1447. */
  1448. int32_t rindex;
  1449. /*!
  1450. * Currently mapped MIDI channel.
  1451. * Counts from 0 to 15.
  1452. */
  1453. uint8_t midiChannel;
  1454. /*!
  1455. * Currently mapped index.
  1456. * @see SpecialMappedControlIndex
  1457. */
  1458. int16_t mappedControlIndex;
  1459. /*!
  1460. * Minimum value that this parameter maps to.
  1461. */
  1462. float mappedMinimum;
  1463. /*!
  1464. * Maximum value that this parameter maps to.
  1465. */
  1466. float mappedMaximum;
  1467. /*!
  1468. * Flags related to the current mapping of this parameter.
  1469. * @see MappedParameterFlags
  1470. */
  1471. uint mappedFlags;
  1472. } ParameterData;
  1473. /*!
  1474. * Parameter ranges.
  1475. */
  1476. typedef struct _ParameterRanges {
  1477. /*!
  1478. * Default value.
  1479. */
  1480. float def;
  1481. /*!
  1482. * Minimum value.
  1483. */
  1484. float min;
  1485. /*!
  1486. * Maximum value.
  1487. */
  1488. float max;
  1489. /*!
  1490. * Regular, single step value.
  1491. */
  1492. float step;
  1493. /*!
  1494. * Small step value.
  1495. */
  1496. float stepSmall;
  1497. /*!
  1498. * Large step value.
  1499. */
  1500. float stepLarge;
  1501. #ifdef __cplusplus
  1502. /*!
  1503. * Fix the default value within range.
  1504. */
  1505. void fixDefault() noexcept
  1506. {
  1507. fixValue(def);
  1508. }
  1509. /*!
  1510. * Fix a value within range.
  1511. */
  1512. void fixValue(float& value) const noexcept
  1513. {
  1514. if (value < min)
  1515. value = min;
  1516. else if (value > max)
  1517. value = max;
  1518. }
  1519. /*!
  1520. * Get a fixed value within range.
  1521. */
  1522. const float& getFixedValue(const float& value) const noexcept
  1523. {
  1524. if (value <= min)
  1525. return min;
  1526. if (value >= max)
  1527. return max;
  1528. return value;
  1529. }
  1530. /*!
  1531. * Get a value normalized to 0.0<->1.0.
  1532. */
  1533. float getNormalizedValue(const float& value) const noexcept
  1534. {
  1535. const float normValue = (value - min) / (max - min);
  1536. if (normValue <= 0.0f)
  1537. return 0.0f;
  1538. if (normValue >= 1.0f)
  1539. return 1.0f;
  1540. return normValue;
  1541. }
  1542. /*!
  1543. * Get a value normalized to 0.0<->1.0.
  1544. * Double-precision variant.
  1545. */
  1546. double getNormalizedValue(const double& value) const noexcept
  1547. {
  1548. const double normValue = (value - min) / (max - min);
  1549. if (normValue <= 0.0)
  1550. return 0.0;
  1551. if (normValue >= 1.0)
  1552. return 1.0;
  1553. return normValue;
  1554. }
  1555. /*!
  1556. * Get a value normalized to 0.0<->1.0, fixed within range.
  1557. */
  1558. float getFixedAndNormalizedValue(const float& value) const noexcept
  1559. {
  1560. if (value <= min)
  1561. return 0.0f;
  1562. if (value >= max)
  1563. return 1.0f;
  1564. const float normValue((value - min) / (max - min));
  1565. if (normValue <= 0.0f)
  1566. return 0.0f;
  1567. if (normValue >= 1.0f)
  1568. return 1.0f;
  1569. return normValue;
  1570. }
  1571. /*!
  1572. * Get a proper value previously normalized to 0.0<->1.0.
  1573. */
  1574. float getUnnormalizedValue(const float& value) const noexcept
  1575. {
  1576. if (value <= 0.0f)
  1577. return min;
  1578. if (value >= 1.0f)
  1579. return max;
  1580. return value * (max - min) + min;
  1581. }
  1582. /*!
  1583. * Get a logarithmic value previously normalized to 0.0<->1.0.
  1584. */
  1585. float getUnnormalizedLogValue(const float& value) const noexcept
  1586. {
  1587. if (value <= 0.0f)
  1588. return min;
  1589. if (value >= 1.0f)
  1590. return max;
  1591. float rmin = min;
  1592. if (std::abs(min) < std::numeric_limits<float>::epsilon())
  1593. rmin = 0.00001f;
  1594. return rmin * std::pow(max/rmin, value);
  1595. }
  1596. #endif /* __cplusplus */
  1597. } ParameterRanges;
  1598. /*!
  1599. * MIDI Program data.
  1600. */
  1601. typedef struct {
  1602. /*!
  1603. * MIDI bank.
  1604. */
  1605. uint32_t bank;
  1606. /*!
  1607. * MIDI program.
  1608. */
  1609. uint32_t program;
  1610. /*!
  1611. * MIDI program name.
  1612. */
  1613. const char* name;
  1614. } MidiProgramData;
  1615. /*!
  1616. * Custom data, used for saving key:value 'dictionaries'.
  1617. */
  1618. typedef struct _CustomData {
  1619. /*!
  1620. * Value type, in URI form.
  1621. * @see CustomDataTypes
  1622. */
  1623. const char* type;
  1624. /*!
  1625. * Key.
  1626. * @see CustomDataKeys
  1627. */
  1628. const char* key;
  1629. /*!
  1630. * Value.
  1631. */
  1632. const char* value;
  1633. #ifdef __cplusplus
  1634. /*!
  1635. * Check if valid.
  1636. */
  1637. bool isValid() const noexcept
  1638. {
  1639. if (type == nullptr || type[0] == '\0') return false;
  1640. if (key == nullptr || key [0] == '\0') return false;
  1641. if (value == nullptr) return false;
  1642. return true;
  1643. }
  1644. #endif /* __cplusplus */
  1645. } CustomData;
  1646. /*!
  1647. * Engine driver device information.
  1648. */
  1649. typedef struct {
  1650. /*!
  1651. * This driver device hints.
  1652. * @see EngineDriverHints
  1653. */
  1654. uint hints;
  1655. /*!
  1656. * Available buffer sizes.
  1657. * Terminated with 0.
  1658. */
  1659. const uint32_t* bufferSizes;
  1660. /*!
  1661. * Available sample rates.
  1662. * Terminated with 0.0.
  1663. */
  1664. const double* sampleRates;
  1665. } EngineDriverDeviceInfo;
  1666. /** @} */
  1667. #ifdef __cplusplus
  1668. /* Forward declarations of commonly used Carla classes */
  1669. class CarlaEngine;
  1670. class CarlaEngineClient;
  1671. class CarlaEngineCVSourcePorts;
  1672. class CarlaPlugin;
  1673. /* End namespace */
  1674. CARLA_BACKEND_END_NAMESPACE
  1675. #endif
  1676. #endif /* CARLA_BACKEND_H_INCLUDED */