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.

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