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.

785 lines
22KB

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