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.

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