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.

1988 lines
45KB

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