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.

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