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.

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