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.

1950 lines
44KB

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