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.

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