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.

1983 lines
44KB

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