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.

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