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.

1927 lines
43KB

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