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.

772 lines
21KB

  1. /*
  2. * Carla Backend API
  3. * Copyright (C) 2011-2013 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 GPL.txt file
  16. */
  17. #ifndef __CARLA_BACKEND_HPP__
  18. #define __CARLA_BACKEND_HPP__
  19. #include "CarlaDefines.hpp"
  20. #include <cstdint>
  21. #define CARLA_BACKEND_START_NAMESPACE namespace CarlaBackend {
  22. #define CARLA_BACKEND_END_NAMESPACE }
  23. #define CARLA_BACKEND_USE_NAMESPACE using namespace CarlaBackend;
  24. #define STR_MAX 0xFF
  25. CARLA_BACKEND_START_NAMESPACE
  26. /*!
  27. * @defgroup CarlaBackendAPI Carla Backend API
  28. *
  29. * The Carla Backend API.\n
  30. * This is the base definitions for everything in the Carla code.
  31. *
  32. * @{
  33. */
  34. const unsigned int MAX_DEFAULT_PLUGINS = 99; //!< Maximum default number of loadable plugins
  35. const unsigned int MAX_RACK_PLUGINS = 16; //!< Maximum number of loadable plugins in rack mode
  36. const unsigned int MAX_PATCHBAY_PLUGINS = 255; //!< Maximum number of loadable plugins in patchbay mode
  37. const unsigned int MAX_DEFAULT_PARAMETERS = 200; //!< Maximum default number of parameters allowed.\see OPTION_MAX_PARAMETERS
  38. /*!
  39. * @defgroup PluginHints Plugin Hints
  40. *
  41. * Various plugin hints.
  42. * \see CarlaPlugin::hints()
  43. * @{
  44. */
  45. const unsigned int PLUGIN_IS_BRIDGE = 0x001; //!< Plugin is a bridge (ie, BridgePlugin). This hint is required because "bridge" itself is not a plugin type.
  46. const unsigned int PLUGIN_IS_RTSAFE = 0x002; //!< Plugin is hard real-time safe.
  47. const unsigned int PLUGIN_IS_SYNTH = 0x004; //!< Plugin is a synthesizer (produces sound).
  48. const unsigned int PLUGIN_HAS_GUI = 0x010; //!< Plugin has its own custom GUI.
  49. const unsigned int PLUGIN_HAS_SINGLE_THREAD = 0x020; //!< Plugin needs a single thread for both DSP and UI events.
  50. const unsigned int PLUGIN_CAN_DRYWET = 0x100; //!< Plugin can make use of Dry/Wet controls.
  51. const unsigned int PLUGIN_CAN_VOLUME = 0x200; //!< Plugin can make use of Volume controls.
  52. const unsigned int PLUGIN_CAN_BALANCE = 0x400; //!< Plugin can make use of Left & Right Balance controls.
  53. const unsigned int PLUGIN_CAN_PANNING = 0x800; //!< Plugin can make use of Panning controls.
  54. /**@}*/
  55. /*!
  56. * @defgroup PluginOptions Plugin Options
  57. *
  58. * Various plugin options.
  59. * \see CarlaPlugin::availableOptions() and CarlaPlugin::options()
  60. * @{
  61. */
  62. const unsigned int PLUGIN_OPTION_FIXED_BUFFER = 0x001; //!< Use a constant, fixed-size audio buffer
  63. const unsigned int PLUGIN_OPTION_FORCE_STEREO = 0x002; //!< Force mono plugin as stereo
  64. const unsigned int PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004; //!< Map MIDI-Programs to plugin programs
  65. const unsigned int PLUGIN_OPTION_USE_CHUNKS = 0x008; //!< Use chunks to save data
  66. const unsigned int PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010; //!< Send MIDI CC events
  67. const unsigned int PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020; //!< Send MIDI channel pressure events
  68. const unsigned int PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040; //!< Send MIDI note aftertouch events
  69. const unsigned int PLUGIN_OPTION_SEND_PITCHBEND = 0x080; //!< Send MIDI pitchbend events
  70. const unsigned int PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100; //!< Send MIDI all sounds/notes off events, single-note offs otherwise
  71. /**@}*/
  72. /*!
  73. * @defgroup ParameterHints Parameter Hints
  74. *
  75. * Various parameter hints.
  76. * \see CarlaPlugin::parameterData()
  77. * @{
  78. */
  79. const unsigned int PARAMETER_IS_BOOLEAN = 0x01; //!< Parameter value is a boolean (always at minimum or maximum values).
  80. const unsigned int PARAMETER_IS_INTEGER = 0x02; //!< Parameter value is an integer.
  81. const unsigned int PARAMETER_IS_LOGARITHMIC = 0x04; //!< Parameter is logarithmic.
  82. const unsigned int PARAMETER_IS_ENABLED = 0x08; //!< Parameter is enabled and will be shown in the host built-in editor.
  83. const unsigned int PARAMETER_IS_AUTOMABLE = 0x10; //!< Parameter is automable (realtime safe)
  84. const unsigned int PARAMETER_USES_SAMPLERATE = 0x20; //!< Parameter needs sample rate to work (value and ranges are multiplied by SR, and must be divided by SR on save).
  85. const unsigned int PARAMETER_USES_SCALEPOINTS = 0x40; //!< Parameter uses scalepoints to define internal values in a meaningful way.
  86. const unsigned int PARAMETER_USES_CUSTOM_TEXT = 0x80; //!< Parameter uses custom text for displaying its value.\see CarlaPlugin::getParameterText()
  87. /**@}*/
  88. /*!
  89. * @defgroup PatchbayPortHints Patchbay Port Hints
  90. *
  91. * Various patchbay port hints.
  92. * @{
  93. */
  94. const unsigned int PATCHBAY_PORT_IS_INPUT = 0x1; //!< Patchbay port is input.
  95. const unsigned int PATCHBAY_PORT_IS_OUTPUT = 0x2; //!< Patchbay port is output.
  96. const unsigned int PATCHBAY_PORT_IS_AUDIO = 0x4; //!< Patchbay port is of Audio type.
  97. const unsigned int PATCHBAY_PORT_IS_MIDI = 0x8; //!< Patchbay port is of MIDI type.
  98. /**@}*/
  99. /*!
  100. * @defgroup CustomDataTypes Custom Data types
  101. *
  102. * The type defines how the \param value in CustomData is stored.
  103. *
  104. * Types are valid URIs.\n
  105. * Any non-string, non-simple type (not integral) is saved in a base64 encoded format.
  106. */
  107. const char* const CUSTOM_DATA_INVALID = nullptr; //!< Null or Invalid data.
  108. const char* const CUSTOM_DATA_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"; //!< Carla Chunk URI
  109. const char* const CUSTOM_DATA_STRING = "http://kxstudio.sf.net/ns/carla/string"; //!< Carla String URI
  110. /**@}*/
  111. /*!
  112. * The binary type of a plugin.
  113. */
  114. enum BinaryType {
  115. BINARY_NONE = 0, //!< Null binary type.
  116. BINARY_POSIX32 = 1, //!< POSIX 32bit.
  117. BINARY_POSIX64 = 2, //!< POSIX 64bit.
  118. BINARY_WIN32 = 3, //!< Windows 32bit.
  119. BINARY_WIN64 = 4, //!< Windows 64bit.
  120. BINARY_OTHER = 5 //!< Other.
  121. };
  122. /*!
  123. * All the available plugin types, as provided by subclasses of CarlaPlugin.\n
  124. * Some plugin classes might provide more than 1 plugin type.
  125. */
  126. enum PluginType {
  127. PLUGIN_NONE = 0, //!< Null plugin type.
  128. PLUGIN_INTERNAL = 1, //!< Internal plugin.
  129. PLUGIN_LADSPA = 2, //!< LADSPA plugin.
  130. PLUGIN_DSSI = 3, //!< DSSI plugin.
  131. PLUGIN_LV2 = 4, //!< LV2 plugin.
  132. PLUGIN_VST = 5, //!< VST1/2 plugin.
  133. PLUGIN_VST3 = 6, //!< VST3 plugin.
  134. PLUGIN_GIG = 7, //!< GIG sound kit, implemented via LinuxSampler.
  135. PLUGIN_SF2 = 8, //!< SF2 sound kit (aka SoundFont), implemented via FluidSynth.
  136. PLUGIN_SFZ = 9 //!< SFZ sound kit, implemented via LinuxSampler.
  137. };
  138. /*!
  139. * Plugin category, describing the funtionality of a plugin.\n
  140. * When a plugin fails to tell his own category, one is atributted to it based on its name.
  141. */
  142. enum PluginCategory {
  143. PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category.
  144. PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator.
  145. PLUGIN_CATEGORY_DELAY = 2, //!< A delay or reverberator.
  146. PLUGIN_CATEGORY_EQ = 3, //!< An equalizer.
  147. PLUGIN_CATEGORY_FILTER = 4, //!< A filter.
  148. PLUGIN_CATEGORY_DYNAMICS = 5, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc).
  149. PLUGIN_CATEGORY_MODULATOR = 6, //!< A 'modulator' plugin (chorus, flanger, phaser, etc).
  150. PLUGIN_CATEGORY_UTILITY = 7, //!< An 'utility' plugin (analyzer, converter, mixer, etc).
  151. PLUGIN_CATEGORY_OTHER = 8 //!< Misc plugin (used to check if the plugin has a category).
  152. };
  153. /*!
  154. * Plugin parameter type.
  155. */
  156. enum ParameterType {
  157. PARAMETER_UNKNOWN = 0, //!< Null parameter type.
  158. PARAMETER_INPUT = 1, //!< Input parameter.
  159. PARAMETER_OUTPUT = 2, //!< Ouput parameter.
  160. PARAMETER_LATENCY = 3, //!< Special latency parameter, used in LADSPA, DSSI and LV2 plugins.
  161. PARAMETER_SAMPLE_RATE = 4, //!< Special sample-rate parameter, used in LADSPA, DSSI and LV2 plugins.
  162. #ifdef WANT_LV2
  163. PARAMETER_LV2_FREEWHEEL = 5, //!< Special LV2 Plugin parameter used to report freewheel (offline) mode.
  164. PARAMETER_LV2_TIME = 6 //!< Special LV2 Plugin parameter used to report time information.
  165. #endif
  166. };
  167. /*!
  168. * Internal parameter indexes.\n
  169. * These are special parameters used internally, plugins do not know about their existence.
  170. */
  171. enum InternalParametersIndex {
  172. PARAMETER_NULL = -1, //!< Null parameter.
  173. PARAMETER_ACTIVE = -2, //!< Active parameter, can only be 'true' or 'false'; default is 'false'.
  174. PARAMETER_DRYWET = -3, //!< Dry/Wet parameter, range 0.0...1.0; default is 1.0.
  175. PARAMETER_VOLUME = -4, //!< Volume parameter, range 0.0...1.27; default is 1.0.
  176. PARAMETER_BALANCE_LEFT = -5, //!< Stereo Balance-Left parameter, range -1.0...1.0; default is -1.0.
  177. PARAMETER_BALANCE_RIGHT = -6, //!< Stereo Balance-Right parameter, range -1.0...1.0; default is 1.0.
  178. PARAMETER_PANNING = -7, //!< Mono Panning parameter, range -1.0...1.0; default is 0.0.
  179. PARAMETER_CTRL_CHANNEL = -8, //!< MIDI Control channel
  180. PARAMETER_MAX = -9 //!< Max value, defined for convenience
  181. };
  182. /*!
  183. * Options used in the CarlaEngine::setOption() and set_option() calls.\n
  184. * All options except paths must be set before initiliazing or after closing the engine.
  185. */
  186. enum OptionsType {
  187. /*!
  188. * Try to set the current process name.
  189. * \note Not available on all platforms.
  190. */
  191. OPTION_PROCESS_NAME = 0,
  192. /*!
  193. * Set the engine processing mode.\n
  194. * Default is PROCESS_MODE_CONTINUOUS_RACK.
  195. * \see ProcessMode
  196. */
  197. OPTION_PROCESS_MODE = 1,
  198. /*!
  199. * Set the engine transport mode.\n
  200. * Default is TRANSPORT_MODE_INTERNAL.
  201. * \see TransportMode
  202. */
  203. OPTION_TRANSPORT_MODE = 2,
  204. /*!
  205. * Force mono plugins as stereo, by running 2 instances at the same time.
  206. * \note Not supported by all plugins.
  207. */
  208. OPTION_FORCE_STEREO = 3,
  209. /*!
  210. * Use plugin bridges whenever possible.\n
  211. * Default is no, EXPERIMENTAL.
  212. */
  213. OPTION_PREFER_PLUGIN_BRIDGES = 4,
  214. /*!
  215. * Use OSC-UI bridges whenever possible, otherwise UIs will be handled in the main thread.\n
  216. * Default is yes.
  217. */
  218. OPTION_PREFER_UI_BRIDGES = 5,
  219. #ifdef WANT_DSSI
  220. /*!
  221. * Use (unofficial) dssi-vst chunks feature.\n
  222. * Default is no.
  223. */
  224. OPTION_USE_DSSI_VST_CHUNKS = 6,
  225. #endif
  226. /*!
  227. * Maximum number of parameters allowed.\n
  228. * Default is MAX_DEFAULT_PARAMETERS.
  229. */
  230. OPTION_MAX_PARAMETERS = 7,
  231. /*!
  232. * Timeout value in ms for how much to wait for OSC-Bridges to respond.\n
  233. * Default is 4000 (4 secs).
  234. */
  235. OPTION_OSC_UI_TIMEOUT = 8,
  236. /*!
  237. * JACK auto-connect to hardware ports.
  238. */
  239. OPTION_JACK_AUTOCONNECT = 9,
  240. /*!
  241. * JACK Transport master.
  242. */
  243. OPTION_JACK_TIMEMASTER = 10,
  244. #ifdef WANT_RTAUDIO
  245. /*!
  246. * RtAudio buffer size.
  247. */
  248. OPTION_RTAUDIO_BUFFER_SIZE = 11,
  249. /*!
  250. * RtAudio sample rate.
  251. */
  252. OPTION_RTAUDIO_SAMPLE_RATE = 12,
  253. /*!
  254. * RtAudio device.
  255. */
  256. OPTION_RTAUDIO_DEVICE = 13,
  257. #endif
  258. #ifndef BUILD_BRIDGE
  259. /*!
  260. * Set path to the native plugin bridge executable.\n
  261. * Default unset.
  262. */
  263. OPTION_PATH_BRIDGE_NATIVE = 14,
  264. /*!
  265. * Set path to the POSIX 32bit plugin bridge executable.\n
  266. * Default unset.
  267. */
  268. OPTION_PATH_BRIDGE_POSIX32 = 15,
  269. /*!
  270. * Set path to the POSIX 64bit plugin bridge executable.\n
  271. * Default unset.
  272. */
  273. OPTION_PATH_BRIDGE_POSIX64 = 16,
  274. /*!
  275. * Set path to the Windows 32bit plugin bridge executable.\n
  276. * Default unset.
  277. */
  278. OPTION_PATH_BRIDGE_WIN32 = 17,
  279. /*!
  280. * Set path to the Windows 64bit plugin bridge executable.\n
  281. * Default unset.
  282. */
  283. OPTION_PATH_BRIDGE_WIN64 = 18,
  284. #endif
  285. #ifdef WANT_LV2
  286. /*!
  287. * Set path to the LV2 Gtk2 UI bridge executable.\n
  288. * Default unset.
  289. */
  290. OPTION_PATH_BRIDGE_LV2_GTK2 = 19,
  291. /*!
  292. * Set path to the LV2 Gtk3 UI bridge executable.\n
  293. * Default unset.
  294. */
  295. OPTION_PATH_BRIDGE_LV2_GTK3 = 20,
  296. /*!
  297. * Set path to the LV2 Qt4 UI bridge executable.\n
  298. * Default unset.
  299. */
  300. OPTION_PATH_BRIDGE_LV2_QT4 = 21,
  301. /*!
  302. * Set path to the LV2 Qt5 UI bridge executable.\n
  303. * Default unset.
  304. */
  305. OPTION_PATH_BRIDGE_LV2_QT5 = 22,
  306. /*!
  307. * Set path to the LV2 Cocoa UI bridge executable.\n
  308. * Default unset.
  309. */
  310. OPTION_PATH_BRIDGE_LV2_COCOA = 23,
  311. /*!
  312. * Set path to the LV2 Windows UI bridge executable.\n
  313. * Default unset.
  314. */
  315. OPTION_PATH_BRIDGE_LV2_WINDOWS = 24,
  316. /*!
  317. * Set path to the LV2 X11 UI bridge executable.\n
  318. * Default unset.
  319. */
  320. OPTION_PATH_BRIDGE_LV2_X11 = 25,
  321. #endif
  322. #ifdef WANT_VST
  323. /*!
  324. * Set path to the VST Cocoa UI bridge executable.\n
  325. * Default unset.
  326. */
  327. OPTION_PATH_BRIDGE_VST_COCOA = 26,
  328. /*!
  329. * Set path to the VST HWND UI bridge executable.\n
  330. * Default unset.
  331. */
  332. OPTION_PATH_BRIDGE_VST_HWND = 27,
  333. /*!
  334. * Set path to the VST X11 UI bridge executable.\n
  335. * Default unset.
  336. */
  337. OPTION_PATH_BRIDGE_VST_X11 = 28
  338. #endif
  339. };
  340. /*!
  341. * Opcodes sent from the engine callback to the GUI, as defined by CallbackFunc.
  342. *
  343. * \see CarlaEngine::setCallback() and set_callback_function()
  344. */
  345. enum CallbackType {
  346. /*!
  347. * Debug.\n
  348. * This opcode is undefined and used only for testing purposes.
  349. */
  350. CALLBACK_DEBUG = 0,
  351. /*!
  352. * A plugin has been added.
  353. * \param valueStr Plugin name
  354. */
  355. CALLBACK_PLUGIN_ADDED = 1,
  356. /*!
  357. * A plugin has been removed.
  358. */
  359. CALLBACK_PLUGIN_REMOVED = 2,
  360. /*!
  361. * A plugin has been renamed.
  362. * \param valueStr New name
  363. */
  364. CALLBACK_PLUGIN_RENAMED = 3,
  365. /*!
  366. * A parameter value has been changed.
  367. *
  368. * \param value1 Parameter index
  369. * \param value3 Value
  370. */
  371. CALLBACK_PARAMETER_VALUE_CHANGED = 4,
  372. /*!
  373. * A parameter default has changed.
  374. *
  375. * \param value1 Parameter index
  376. * \param value3 New default value
  377. */
  378. CALLBACK_PARAMETER_DEFAULT_CHANGED = 5,
  379. /*!
  380. * A parameter's MIDI channel has been changed.
  381. *
  382. * \param value1 Parameter index
  383. * \param value2 MIDI channel
  384. */
  385. CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 6,
  386. /*!
  387. * A parameter's MIDI CC has been changed.
  388. *
  389. * \param value1 Parameter index
  390. * \param value2 MIDI CC
  391. */
  392. CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7,
  393. /*!
  394. * The current program has has been changed.
  395. *
  396. * \param value1 Program index
  397. */
  398. CALLBACK_PROGRAM_CHANGED = 8,
  399. /*!
  400. * The current MIDI program has been changed.
  401. *
  402. * \param value1 MIDI bank
  403. * \param value2 MIDI program
  404. */
  405. CALLBACK_MIDI_PROGRAM_CHANGED = 9,
  406. /*!
  407. * A note has been pressed.
  408. *
  409. * \param value1 Channel
  410. * \param value2 Note
  411. * \param value3 Velocity
  412. */
  413. CALLBACK_NOTE_ON = 10,
  414. /*!
  415. * A note has been released.
  416. *
  417. * \param value1 Channel
  418. * \param value2 Note
  419. */
  420. CALLBACK_NOTE_OFF = 11,
  421. /*!
  422. * The plugin's custom GUI state has changed.
  423. *
  424. * \param value1 State, as follows:.\n
  425. * 0: GUI has been closed or hidden\n
  426. * 1: GUI has been shown\n
  427. * -1: GUI has crashed and should not be shown again
  428. */
  429. CALLBACK_SHOW_GUI = 12,
  430. /*!
  431. * The plugin needs update.
  432. */
  433. CALLBACK_UPDATE = 13,
  434. /*!
  435. * The plugin's data/information has changed.
  436. */
  437. CALLBACK_RELOAD_INFO = 14,
  438. /*!
  439. * The plugin's parameters have changed.
  440. */
  441. CALLBACK_RELOAD_PARAMETERS = 15,
  442. /*!
  443. * The plugin's programs have changed.
  444. */
  445. CALLBACK_RELOAD_PROGRAMS = 16,
  446. /*!
  447. * The plugin's state has changed.
  448. */
  449. CALLBACK_RELOAD_ALL = 17,
  450. /*!
  451. * Canvas client added
  452. *
  453. * \param value1 Client Id
  454. * \param valueStr Client name
  455. */
  456. CALLBACK_PATCHBAY_CLIENT_ADDED = 18,
  457. /*!
  458. * Canvas client removed
  459. *
  460. * \param value1 Client Id
  461. */
  462. CALLBACK_PATCHBAY_CLIENT_REMOVED = 19,
  463. /*!
  464. * Canvas client renamed
  465. *
  466. * \param value1 Client Id
  467. * \param valueStr New client name
  468. */
  469. CALLBACK_PATCHBAY_CLIENT_RENAMED = 20,
  470. /*!
  471. * Canvas port added
  472. *
  473. * \param value1 Client Id
  474. * \param value2 Port Id
  475. * \param value3 Port flags
  476. * \param valueStr Port name
  477. */
  478. CALLBACK_PATCHBAY_PORT_ADDED = 21,
  479. /*!
  480. * Canvas port remvoed
  481. *
  482. * \param value1 Port Id
  483. */
  484. CALLBACK_PATCHBAY_PORT_REMOVED = 22,
  485. /*!
  486. * Canvas port renamed
  487. *
  488. * \param value1 Port Id
  489. * \param valueStr New port name
  490. */
  491. CALLBACK_PATCHBAY_PORT_RENAMED = 23,
  492. /*!
  493. * Canvas port connection added
  494. *
  495. * \param value1 Output port Id
  496. * \param value2 Input port Id
  497. */
  498. CALLBACK_PATCHBAY_CONNECTION_ADDED = 24,
  499. /*!
  500. * Canvas port connection removed
  501. *
  502. * \param value1 Output port Id
  503. * \param value2 Input port Id
  504. */
  505. CALLBACK_PATCHBAY_CONNECTION_REMOVED = 25,
  506. /*!
  507. * Non-Session-Manager Announce message.
  508. */
  509. CALLBACK_BUFFER_SIZE_CHANGED = 26,
  510. /*!
  511. * Non-Session-Manager Announce message.
  512. */
  513. CALLBACK_SAMPLE_RATE_CHANGED = 27,
  514. /*!
  515. * Non-Session-Manager Announce message.
  516. */
  517. CALLBACK_NSM_ANNOUNCE = 28,
  518. /*!
  519. * Non-Session-Manager Open message.
  520. */
  521. CALLBACK_NSM_OPEN = 29,
  522. /*!
  523. * Non-Session-Manager Save message.
  524. */
  525. CALLBACK_NSM_SAVE = 30,
  526. /*!
  527. * An error occurred, show \a valueStr as an error to user.
  528. */
  529. CALLBACK_ERROR = 31,
  530. /*!
  531. * The engine has crashed or malfunctioned and will no longer work.
  532. */
  533. CALLBACK_QUIT = 32
  534. };
  535. /*!
  536. * Engine process mode.
  537. *
  538. * \see OPTION_PROCESS_MODE
  539. */
  540. enum ProcessMode {
  541. PROCESS_MODE_SINGLE_CLIENT = 0, //!< Single client mode (dynamic input/outputs as needed by plugins)
  542. PROCESS_MODE_MULTIPLE_CLIENTS = 1, //!< Multiple client mode (1 master client + 1 client per plugin)
  543. PROCESS_MODE_CONTINUOUS_RACK = 2, //!< Single client, 'rack' mode. Processes plugins in order of Id, with forced stereo.
  544. PROCESS_MODE_PATCHBAY = 3, //!< Single client, 'patchbay' mode.
  545. PROCESS_MODE_BRIDGE = 4 //!< Special mode, used in plugin-bridges only.
  546. };
  547. /*!
  548. * All the available transport modes
  549. */
  550. enum TransportMode {
  551. TRANSPORT_MODE_INTERNAL = 0, //!< Internal transport mode.
  552. TRANSPORT_MODE_JACK = 1, //!< JACK transport, only available if driver name is "JACK"
  553. TRANSPORT_MODE_BRIDGE = 2 //!< Special mode, used in plugin-bridges only.
  554. };
  555. /*!
  556. * Callback function the engine will call when something interesting happens.
  557. *
  558. * \see CallbackType and set_callback_function()
  559. */
  560. typedef void (*CallbackFunc)(void* ptr, CallbackType action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr);
  561. /*!
  562. * Parameter data
  563. */
  564. struct ParameterData {
  565. ParameterType type;
  566. int32_t index;
  567. int32_t rindex;
  568. uint32_t hints;
  569. uint8_t midiChannel;
  570. int16_t midiCC;
  571. #ifndef DOXYGEN
  572. ParameterData()
  573. : type(PARAMETER_UNKNOWN),
  574. index(PARAMETER_NULL),
  575. rindex(-1),
  576. hints(0x0),
  577. midiChannel(0),
  578. midiCC(-1) {}
  579. #endif
  580. };
  581. /*!
  582. * Parameter ranges
  583. */
  584. struct ParameterRanges {
  585. float def;
  586. float min;
  587. float max;
  588. float step;
  589. float stepSmall;
  590. float stepLarge;
  591. #ifndef DOXYGEN
  592. ParameterRanges()
  593. : def(0.0f),
  594. min(0.0f),
  595. max(1.0f),
  596. step(0.01f),
  597. stepSmall(0.0001f),
  598. stepLarge(0.1f) {}
  599. #endif
  600. void fixDefault()
  601. {
  602. fixValue(def);
  603. }
  604. void fixValue(float& value) const
  605. {
  606. if (value < min)
  607. value = min;
  608. else if (value > max)
  609. value = max;
  610. }
  611. float fixValue(const float& value) const
  612. {
  613. if (value < min)
  614. return min;
  615. else if (value > max)
  616. return max;
  617. return value;
  618. }
  619. float normalizeValue(const float& value) const
  620. {
  621. float newValue = (value - min) / (max - min);
  622. if (newValue < 0.0f)
  623. newValue = 0.0f;
  624. else if (newValue < 1.0f)
  625. newValue = 1.0f;
  626. return newValue;
  627. }
  628. float unnormalizeValue(const float& value) const
  629. {
  630. return value * (max - min) + min;
  631. }
  632. };
  633. /*!
  634. * MIDI Program data
  635. */
  636. struct MidiProgramData {
  637. uint32_t bank;
  638. uint32_t program;
  639. const char* name;
  640. #ifndef DOXYGEN
  641. MidiProgramData()
  642. : bank(0),
  643. program(0),
  644. name(nullptr) {}
  645. #endif
  646. };
  647. /*!
  648. * Custom data, saving key:value 'dictionaries'.\n
  649. * \a type is an URI which defines the \a value type.
  650. *
  651. * \see CustomDataTypes
  652. */
  653. struct CustomData {
  654. const char* type;
  655. const char* key;
  656. const char* value;
  657. #ifndef DOXYGEN
  658. CustomData()
  659. : type(nullptr),
  660. key(nullptr),
  661. value(nullptr) {}
  662. #endif
  663. };
  664. /**@}*/
  665. // forward declarations of commonly used Carla classes
  666. class CarlaEngine;
  667. class CarlaPlugin;
  668. CARLA_BACKEND_END_NAMESPACE
  669. #endif // __CARLA_BACKEND_HPP__