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.

767 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. #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. #if 0
  112. /*!
  113. * @defgroup BridgeMessages Bridge Messages
  114. *
  115. * Various bridge related messages, used as configure(<message>, value).
  116. * \note This is for internal use only.
  117. *
  118. * TODO: Review these, may not be needed anymore
  119. * @{
  120. */
  121. const char* const CARLA_BRIDGE_MSG_HIDE_GUI = "CarlaBridgeHideGUI"; //!< Plugin -> Host call, tells host GUI is now hidden
  122. const char* const CARLA_BRIDGE_MSG_SAVED = "CarlaBridgeSaved"; //!< Plugin -> Host call, tells host state is saved
  123. const char* const CARLA_BRIDGE_MSG_SAVE_NOW = "CarlaBridgeSaveNow"; //!< Host -> Plugin call, tells plugin to save state now
  124. const char* const CARLA_BRIDGE_MSG_SET_CHUNK = "CarlaBridgeSetChunk"; //!< Host -> Plugin call, tells plugin to set chunk in file \a value
  125. const char* const CARLA_BRIDGE_MSG_SET_CUSTOM = "CarlaBridgeSetCustom"; //!< Host -> Plugin call, tells plugin to set a custom data set using \a value ("type·key·rvalue").
  126. //If \a type is 'chunk' or 'binary' \a rvalue refers to chunk file.
  127. /**@}*/
  128. #endif
  129. /*!
  130. * The binary type of a plugin.
  131. */
  132. enum BinaryType {
  133. BINARY_NONE = 0, //!< Null binary type.
  134. BINARY_POSIX32 = 1, //!< POSIX 32bit.
  135. BINARY_POSIX64 = 2, //!< POSIX 64bit.
  136. BINARY_WIN32 = 3, //!< Windows 32bit.
  137. BINARY_WIN64 = 4, //!< Windows 64bit.
  138. BINARY_OTHER = 5 //!< Other.
  139. };
  140. /*!
  141. * All the available plugin types, as provided by subclasses of CarlaPlugin.\n
  142. * Some plugin classes might provide more than 1 plugin type.
  143. */
  144. enum PluginType {
  145. PLUGIN_NONE = 0, //!< Null plugin type.
  146. PLUGIN_INTERNAL = 1, //!< Internal plugin.
  147. PLUGIN_LADSPA = 2, //!< LADSPA plugin.
  148. PLUGIN_DSSI = 3, //!< DSSI plugin.
  149. PLUGIN_LV2 = 4, //!< LV2 plugin.
  150. PLUGIN_VST = 5, //!< VST1/2 plugin.
  151. PLUGIN_VST3 = 6, //!< VST3 plugin.
  152. PLUGIN_GIG = 7, //!< GIG sound kit, implemented via LinuxSampler.
  153. PLUGIN_SF2 = 8, //!< SF2 sound kit (aka SoundFont), implemented via FluidSynth.
  154. PLUGIN_SFZ = 9 //!< SFZ sound kit, implemented via LinuxSampler.
  155. };
  156. /*!
  157. * Plugin category, describing the funtionality of a plugin.\n
  158. * When a plugin fails to tell his own category, one is atributted to it based on its name.
  159. */
  160. enum PluginCategory {
  161. PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category.
  162. PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator.
  163. PLUGIN_CATEGORY_DELAY = 2, //!< A delay or reverberator.
  164. PLUGIN_CATEGORY_EQ = 3, //!< An equalizer.
  165. PLUGIN_CATEGORY_FILTER = 4, //!< A filter.
  166. PLUGIN_CATEGORY_DYNAMICS = 5, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc).
  167. PLUGIN_CATEGORY_MODULATOR = 6, //!< A 'modulator' plugin (chorus, flanger, phaser, etc).
  168. PLUGIN_CATEGORY_UTILITY = 7, //!< An 'utility' plugin (analyzer, converter, mixer, etc).
  169. PLUGIN_CATEGORY_OTHER = 8 //!< Misc plugin (used to check if the plugin has a category).
  170. };
  171. /*!
  172. * Plugin parameter type.
  173. */
  174. enum ParameterType {
  175. PARAMETER_UNKNOWN = 0, //!< Null parameter type.
  176. PARAMETER_INPUT = 1, //!< Input parameter.
  177. PARAMETER_OUTPUT = 2, //!< Ouput parameter.
  178. PARAMETER_LATENCY = 3, //!< Special latency parameter, used in LADSPA, DSSI and LV2 plugins.
  179. PARAMETER_SAMPLE_RATE = 4, //!< Special sample-rate parameter, used in LADSPA, DSSI and LV2 plugins.
  180. #ifdef WANT_LV2
  181. PARAMETER_LV2_FREEWHEEL = 5, //!< Special LV2 Plugin parameter used to report freewheel (offline) mode.
  182. PARAMETER_LV2_TIME = 6 //!< Special LV2 Plugin parameter used to report time information.
  183. #endif
  184. };
  185. /*!
  186. * Internal parameter indexes.\n
  187. * These are special parameters used internally, plugins do not know about their existence.
  188. */
  189. enum InternalParametersIndex {
  190. PARAMETER_NULL = -1, //!< Null parameter.
  191. PARAMETER_ACTIVE = -2, //!< Active parameter, can only be 'true' or 'false'; default is 'false'.
  192. PARAMETER_DRYWET = -3, //!< Dry/Wet parameter, range 0.0...1.0; default is 1.0.
  193. PARAMETER_VOLUME = -4, //!< Volume parameter, range 0.0...1.27; default is 1.0.
  194. PARAMETER_BALANCE_LEFT = -5, //!< Stereo Balance-Left parameter, range -1.0...1.0; default is -1.0.
  195. PARAMETER_BALANCE_RIGHT = -6, //!< Stereo Balance-Right parameter, range -1.0...1.0; default is 1.0.
  196. PARAMETER_PANNING = -7, //!< Mono Panning parameter, range -1.0...1.0; default is 0.0.
  197. PARAMETER_CTRL_CHANNEL = -8, //!< MIDI Control channel
  198. PARAMETER_MAX = -9 //!< Max value, defined for convenience
  199. };
  200. /*!
  201. * Options used in the CarlaEngine::setOption() and set_option() calls.\n
  202. * All options except paths must be set before initiliazing or after closing the engine.
  203. */
  204. enum OptionsType {
  205. /*!
  206. * Try to set the current process name.
  207. * \note Not available on all platforms.
  208. */
  209. OPTION_PROCESS_NAME = 0,
  210. /*!
  211. * Set the engine processing mode.\n
  212. * Default is PROCESS_MODE_CONTINUOUS_RACK.
  213. * \see ProcessMode
  214. */
  215. OPTION_PROCESS_MODE = 1,
  216. /*!
  217. * Set the engine transport mode.\n
  218. * Default is TRANSPORT_MODE_INTERNAL.
  219. * \see TransportMode
  220. */
  221. OPTION_TRANSPORT_MODE = 2,
  222. /*!
  223. * Force mono plugins as stereo, by running 2 instances at the same time.
  224. * \note Not supported by all plugins.
  225. */
  226. OPTION_FORCE_STEREO = 3,
  227. /*!
  228. * Use plugin bridges whenever possible.\n
  229. * Default is no, EXPERIMENTAL.
  230. */
  231. OPTION_PREFER_PLUGIN_BRIDGES = 4,
  232. /*!
  233. * Use OSC-UI bridges whenever possible, otherwise UIs will be handled in the main thread.\n
  234. * Default is yes.
  235. */
  236. OPTION_PREFER_UI_BRIDGES = 5,
  237. #ifdef WANT_DSSI
  238. /*!
  239. * Use (unofficial) dssi-vst chunks feature.\n
  240. * Default is no.
  241. */
  242. OPTION_USE_DSSI_VST_CHUNKS = 6,
  243. #endif
  244. /*!
  245. * Maximum number of parameters allowed.\n
  246. * Default is MAX_DEFAULT_PARAMETERS.
  247. */
  248. OPTION_MAX_PARAMETERS = 7,
  249. /*!
  250. * Timeout value in ms for how much to wait for OSC-Bridges to respond.\n
  251. * Default is 4000 (4 secs).
  252. */
  253. OPTION_OSC_UI_TIMEOUT = 8,
  254. /*!
  255. * Prefered buffer size.
  256. */
  257. OPTION_PREFERRED_BUFFER_SIZE = 9,
  258. /*!
  259. * Prefered sample rate.
  260. */
  261. OPTION_PREFERRED_SAMPLE_RATE = 10,
  262. #ifndef BUILD_BRIDGE
  263. /*!
  264. * Set path to the native plugin bridge executable.\n
  265. * Default unset.
  266. */
  267. OPTION_PATH_BRIDGE_NATIVE = 11,
  268. /*!
  269. * Set path to the POSIX 32bit plugin bridge executable.\n
  270. * Default unset.
  271. */
  272. OPTION_PATH_BRIDGE_POSIX32 = 12,
  273. /*!
  274. * Set path to the POSIX 64bit plugin bridge executable.\n
  275. * Default unset.
  276. */
  277. OPTION_PATH_BRIDGE_POSIX64 = 13,
  278. /*!
  279. * Set path to the Windows 32bit plugin bridge executable.\n
  280. * Default unset.
  281. */
  282. OPTION_PATH_BRIDGE_WIN32 = 14,
  283. /*!
  284. * Set path to the Windows 64bit plugin bridge executable.\n
  285. * Default unset.
  286. */
  287. OPTION_PATH_BRIDGE_WIN64 = 15,
  288. #endif
  289. #ifdef WANT_LV2
  290. /*!
  291. * Set path to the LV2 Gtk2 UI bridge executable.\n
  292. * Default unset.
  293. */
  294. OPTION_PATH_BRIDGE_LV2_GTK2 = 16,
  295. /*!
  296. * Set path to the LV2 Gtk3 UI bridge executable.\n
  297. * Default unset.
  298. */
  299. OPTION_PATH_BRIDGE_LV2_GTK3 = 17,
  300. /*!
  301. * Set path to the LV2 Qt4 UI bridge executable.\n
  302. * Default unset.
  303. */
  304. OPTION_PATH_BRIDGE_LV2_QT4 = 18,
  305. /*!
  306. * Set path to the LV2 Qt5 UI bridge executable.\n
  307. * Default unset.
  308. */
  309. OPTION_PATH_BRIDGE_LV2_QT5 = 19,
  310. /*!
  311. * Set path to the LV2 Cocoa UI bridge executable.\n
  312. * Default unset.
  313. */
  314. OPTION_PATH_BRIDGE_LV2_COCOA = 20,
  315. /*!
  316. * Set path to the LV2 Windows UI bridge executable.\n
  317. * Default unset.
  318. */
  319. OPTION_PATH_BRIDGE_LV2_WINDOWS = 21,
  320. /*!
  321. * Set path to the LV2 X11 UI bridge executable.\n
  322. * Default unset.
  323. */
  324. OPTION_PATH_BRIDGE_LV2_X11 = 22,
  325. #endif
  326. #ifdef WANT_VST
  327. /*!
  328. * Set path to the VST Cocoa UI bridge executable.\n
  329. * Default unset.
  330. */
  331. OPTION_PATH_BRIDGE_VST_COCOA = 23,
  332. /*!
  333. * Set path to the VST HWND UI bridge executable.\n
  334. * Default unset.
  335. */
  336. OPTION_PATH_BRIDGE_VST_HWND = 24,
  337. /*!
  338. * Set path to the VST X11 UI bridge executable.\n
  339. * Default unset.
  340. */
  341. OPTION_PATH_BRIDGE_VST_X11 = 25
  342. #endif
  343. };
  344. /*!
  345. * Opcodes sent from the engine callback to the GUI, as defined by CallbackFunc.
  346. *
  347. * \see CarlaEngine::setCallback() and set_callback_function()
  348. */
  349. enum CallbackType {
  350. /*!
  351. * Debug.\n
  352. * This opcode is undefined and used only for testing purposes.
  353. */
  354. CALLBACK_DEBUG = 0,
  355. /*!
  356. * A plugin has been added.
  357. * \param valueStr Plugin name
  358. */
  359. CALLBACK_PLUGIN_ADDED = 1,
  360. /*!
  361. * A plugin has been removed.
  362. */
  363. CALLBACK_PLUGIN_REMOVED = 2,
  364. /*!
  365. * A plugin has been renamed.
  366. * \param valueStr New name
  367. */
  368. CALLBACK_PLUGIN_RENAMED = 3,
  369. /*!
  370. * A parameter value has been changed.
  371. *
  372. * \param value1 Parameter index
  373. * \param value3 Value
  374. */
  375. CALLBACK_PARAMETER_VALUE_CHANGED = 4,
  376. /*!
  377. * A parameter default has changed.
  378. *
  379. * \param value1 Parameter index
  380. * \param value3 New default value
  381. */
  382. CALLBACK_PARAMETER_DEFAULT_CHANGED = 5,
  383. /*!
  384. * A parameter's MIDI channel has been changed.
  385. *
  386. * \param value1 Parameter index
  387. * \param value2 MIDI channel
  388. */
  389. CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 6,
  390. /*!
  391. * A parameter's MIDI CC has been changed.
  392. *
  393. * \param value1 Parameter index
  394. * \param value2 MIDI CC
  395. */
  396. CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7,
  397. /*!
  398. * The current program has has been changed.
  399. *
  400. * \param value1 Program index
  401. */
  402. CALLBACK_PROGRAM_CHANGED = 8,
  403. /*!
  404. * The current MIDI program has been changed.
  405. *
  406. * \param value1 MIDI bank
  407. * \param value2 MIDI program
  408. */
  409. CALLBACK_MIDI_PROGRAM_CHANGED = 9,
  410. /*!
  411. * A note has been pressed.
  412. *
  413. * \param value1 Channel
  414. * \param value2 Note
  415. * \param value3 Velocity
  416. */
  417. CALLBACK_NOTE_ON = 10,
  418. /*!
  419. * A note has been released.
  420. *
  421. * \param value1 Channel
  422. * \param value2 Note
  423. */
  424. CALLBACK_NOTE_OFF = 11,
  425. /*!
  426. * The plugin's custom GUI state has changed.
  427. *
  428. * \param value1 State, as follows:.\n
  429. * 0: GUI has been closed or hidden\n
  430. * 1: GUI has been shown\n
  431. * -1: GUI has crashed and should not be shown again
  432. */
  433. CALLBACK_SHOW_GUI = 12,
  434. /*!
  435. * The plugin needs update.
  436. */
  437. CALLBACK_UPDATE = 13,
  438. /*!
  439. * The plugin's data/information has changed.
  440. */
  441. CALLBACK_RELOAD_INFO = 14,
  442. /*!
  443. * The plugin's parameters have changed.
  444. */
  445. CALLBACK_RELOAD_PARAMETERS = 15,
  446. /*!
  447. * The plugin's programs have changed.
  448. */
  449. CALLBACK_RELOAD_PROGRAMS = 16,
  450. /*!
  451. * The plugin's state has changed.
  452. */
  453. CALLBACK_RELOAD_ALL = 17,
  454. /*!
  455. * Canvas client added
  456. *
  457. * \param value1 Client Id
  458. * \param valueStr Client name
  459. */
  460. CALLBACK_PATCHBAY_CLIENT_ADDED = 18,
  461. /*!
  462. * Canvas client removed
  463. *
  464. * \param value1 Client Id
  465. */
  466. CALLBACK_PATCHBAY_CLIENT_REMOVED = 19,
  467. /*!
  468. * Canvas client renamed
  469. *
  470. * \param value1 Client Id
  471. * \param valueStr New client name
  472. */
  473. CALLBACK_PATCHBAY_CLIENT_RENAMED = 20,
  474. /*!
  475. * Canvas port added
  476. *
  477. * \param value1 Client Id
  478. * \param value2 Port Id
  479. * \param value3 Port flags
  480. * \param valueStr Port name
  481. */
  482. CALLBACK_PATCHBAY_PORT_ADDED = 21,
  483. /*!
  484. * Canvas port remvoed
  485. *
  486. * \param value1 Port Id
  487. */
  488. CALLBACK_PATCHBAY_PORT_REMOVED = 22,
  489. /*!
  490. * Canvas port renamed
  491. *
  492. * \param value1 Port Id
  493. * \param valueStr New port name
  494. */
  495. CALLBACK_PATCHBAY_PORT_RENAMED = 23,
  496. /*!
  497. * Canvas port connection added
  498. *
  499. * \param value1 Output port Id
  500. * \param value2 Input port Id
  501. */
  502. CALLBACK_PATCHBAY_CONNECTION_ADDED = 24,
  503. /*!
  504. * Canvas port connection removed
  505. *
  506. * \param value1 Output port Id
  507. * \param value2 Input port Id
  508. */
  509. CALLBACK_PATCHBAY_CONNECTION_REMOVED = 25,
  510. /*!
  511. * Non-Session-Manager Announce message.
  512. */
  513. CALLBACK_BUFFER_SIZE_CHANGED = 26,
  514. /*!
  515. * Non-Session-Manager Announce message.
  516. */
  517. CALLBACK_SAMPLE_RATE_CHANGED = 27,
  518. /*!
  519. * Non-Session-Manager Announce message.
  520. */
  521. CALLBACK_NSM_ANNOUNCE = 28,
  522. /*!
  523. * Non-Session-Manager Open message.
  524. */
  525. CALLBACK_NSM_OPEN = 29,
  526. /*!
  527. * Non-Session-Manager Save message.
  528. */
  529. CALLBACK_NSM_SAVE = 30,
  530. /*!
  531. * An error occurred, show \a valueStr as an error to user.
  532. */
  533. CALLBACK_ERROR = 31,
  534. /*!
  535. * The engine has crashed or malfunctioned and will no longer work.
  536. */
  537. CALLBACK_QUIT = 32
  538. };
  539. /*!
  540. * Engine process mode.
  541. *
  542. * \see OPTION_PROCESS_MODE
  543. */
  544. enum ProcessMode {
  545. PROCESS_MODE_SINGLE_CLIENT = 0, //!< Single client mode (dynamic input/outputs as needed by plugins)
  546. PROCESS_MODE_MULTIPLE_CLIENTS = 1, //!< Multiple client mode (1 master client + 1 client per plugin)
  547. PROCESS_MODE_CONTINUOUS_RACK = 2, //!< Single client, 'rack' mode. Processes plugins in order of Id, with forced stereo.
  548. PROCESS_MODE_PATCHBAY = 3, //!< Single client, 'patchbay' mode.
  549. PROCESS_MODE_BRIDGE = 4 //!< Special mode, used in plugin-bridges only.
  550. };
  551. /*!
  552. * All the available transport modes
  553. */
  554. enum TransportMode {
  555. TRANSPORT_MODE_INTERNAL = 0, //!< Internal transport mode.
  556. TRANSPORT_MODE_JACK = 1, //!< JACK transport, only available if driver name is "JACK"
  557. TRANSPORT_MODE_BRIDGE = 2 //!< Special mode, used in plugin-bridges only.
  558. };
  559. /*!
  560. * Callback function the engine will call when something interesting happens.
  561. *
  562. * \see CallbackType and set_callback_function()
  563. */
  564. typedef void (*CallbackFunc)(void* ptr, CallbackType action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr);
  565. /*!
  566. * Parameter data
  567. */
  568. struct ParameterData {
  569. ParameterType type;
  570. int32_t index;
  571. int32_t rindex;
  572. uint32_t hints;
  573. uint8_t midiChannel;
  574. int16_t midiCC;
  575. #ifndef DOXYGEN
  576. ParameterData()
  577. : type(PARAMETER_UNKNOWN),
  578. index(PARAMETER_NULL),
  579. rindex(-1),
  580. hints(0x0),
  581. midiChannel(0),
  582. midiCC(-1) {}
  583. #endif
  584. };
  585. /*!
  586. * Parameter ranges
  587. */
  588. struct ParameterRanges {
  589. float def;
  590. float min;
  591. float max;
  592. float step;
  593. float stepSmall;
  594. float stepLarge;
  595. #ifndef DOXYGEN
  596. ParameterRanges()
  597. : def(0.0f),
  598. min(0.0f),
  599. max(1.0f),
  600. step(0.01f),
  601. stepSmall(0.0001f),
  602. stepLarge(0.1f) {}
  603. #endif
  604. void fixDefault()
  605. {
  606. fixValue(def);
  607. }
  608. void fixValue(float& value) const
  609. {
  610. if (value < min)
  611. value = min;
  612. else if (value > max)
  613. value = max;
  614. }
  615. float fixValue(const float& value) const
  616. {
  617. if (value < min)
  618. return min;
  619. else if (value > max)
  620. return max;
  621. return value;
  622. }
  623. float normalizeValue(const float& value) const
  624. {
  625. return (value - min) / (max - min);
  626. }
  627. float unnormalizeValue(const float& value) const
  628. {
  629. return value * (max - min) + min;
  630. }
  631. };
  632. /*!
  633. * MIDI Program data
  634. */
  635. struct MidiProgramData {
  636. uint32_t bank;
  637. uint32_t program;
  638. const char* name;
  639. #ifndef DOXYGEN
  640. MidiProgramData()
  641. : bank(0),
  642. program(0),
  643. name(nullptr) {}
  644. #endif
  645. };
  646. /*!
  647. * Custom data, saving key:value 'dictionaries'.\n
  648. * \a type is an URI which defines the \a value type.
  649. *
  650. * \see CustomDataTypes
  651. */
  652. struct CustomData {
  653. const char* type;
  654. const char* key;
  655. const char* value;
  656. #ifndef DOXYGEN
  657. CustomData()
  658. : type(nullptr),
  659. key(nullptr),
  660. value(nullptr) {}
  661. #endif
  662. };
  663. /**@}*/
  664. // forward declarations of commonly used Carla classes
  665. class CarlaEngine;
  666. class CarlaPlugin;
  667. CARLA_BACKEND_END_NAMESPACE
  668. #endif // __CARLA_BACKEND_HPP__