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.

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