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.

761 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
  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 = 999; //!< 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.\n
  58. * ON or OFF defines the default plugin value.
  59. * \see 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_SOUND_OFF / ALL_NOTES_OFF events
  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 always a boolean (always at minimum or maximum range).
  80. const unsigned int PARAMETER_IS_INTEGER = 0x02; //!< Parameter value is always 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 meaninful 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/Invalid data.
  108. const char* const CUSTOM_DATA_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"; //!< Carla Chunk
  109. const char* const CUSTOM_DATA_STRING = "http://kxstudio.sf.net/ns/carla/string"; //!< Carla String
  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").\n 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.\see NativePlugin
  146. PLUGIN_LADSPA = 2, //!< LADSPA plugin.\see LadspaPlugin
  147. PLUGIN_DSSI = 3, //!< DSSI plugin.\see DssiPlugin
  148. PLUGIN_LV2 = 4, //!< LV2 plugin.\see Lv2Plugin
  149. PLUGIN_VST = 5, //!< VST plugin.\see VstPlugin
  150. PLUGIN_GIG = 6, //!< GIG sound kit, implemented via LinuxSampler.\see LinuxSamplerPlugin
  151. PLUGIN_SF2 = 7, //!< SF2 sound kit (aka SoundFont), implemented via FluidSynth.\see FluidSynthPlugin
  152. PLUGIN_SFZ = 8 //!< SFZ sound kit, implemented via LinuxSampler.\see LinuxSamplerPlugin
  153. };
  154. /*!
  155. * Plugin category, describing the funtionality of a plugin.\n
  156. * When a plugin fails to tell his own category, one is atributted to it based on its name.
  157. */
  158. enum PluginCategory {
  159. PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category.
  160. PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator.
  161. PLUGIN_CATEGORY_DELAY = 2, //!< A delay or reverberator.
  162. PLUGIN_CATEGORY_EQ = 3, //!< An equalizer.
  163. PLUGIN_CATEGORY_FILTER = 4, //!< A filter.
  164. PLUGIN_CATEGORY_DYNAMICS = 5, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc).
  165. PLUGIN_CATEGORY_MODULATOR = 6, //!< A 'modulator' plugin (chorus, flanger, phaser, etc).
  166. PLUGIN_CATEGORY_UTILITY = 7, //!< An 'utility' plugin (analyzer, converter, mixer, etc).
  167. PLUGIN_CATEGORY_OTHER = 8 //!< Misc plugin (used to check if the plugin has a category).
  168. };
  169. /*!
  170. * Plugin parameter type.
  171. */
  172. enum ParameterType {
  173. PARAMETER_UNKNOWN = 0, //!< Null parameter type.
  174. PARAMETER_INPUT = 1, //!< Input parameter.
  175. PARAMETER_OUTPUT = 2, //!< Ouput parameter.
  176. PARAMETER_LATENCY = 3, //!< Special latency parameter, used in LADSPA, DSSI and LV2 plugins.
  177. PARAMETER_SAMPLE_RATE = 4, //!< Special sample-rate parameter, used in LADSPA, DSSI and LV2 plugins.
  178. #ifdef WANT_LV2
  179. PARAMETER_LV2_FREEWHEEL = 5, //!< Special LV2 Plugin parameter used to report freewheel (offline) mode.
  180. PARAMETER_LV2_TIME = 6 //!< Special LV2 Plugin parameter used to report time information.
  181. #endif
  182. };
  183. /*!
  184. * Internal parameter indexes.\n
  185. * These are special parameters used internally, plugins do not know about their existence.
  186. */
  187. enum InternalParametersIndex {
  188. PARAMETER_NULL = -1, //!< Null parameter.
  189. PARAMETER_ACTIVE = -2, //!< Active parameter, can only be 'true' or 'false'; default is 'false'.
  190. PARAMETER_DRYWET = -3, //!< Dry/Wet parameter, range 0.0...1.0; default is 1.0.
  191. PARAMETER_VOLUME = -4, //!< Volume parameter, range 0.0...1.27; default is 1.0.
  192. PARAMETER_BALANCE_LEFT = -5, //!< Stereo Balance-Left parameter, range -1.0...1.0; default is -1.0.
  193. PARAMETER_BALANCE_RIGHT = -6, //!< Stereo Balance-Right parameter, range -1.0...1.0; default is 1.0.
  194. PARAMETER_PANNING = -7, //!< Mono Panning parameter, range -1.0...1.0; default is 0.0.
  195. PARAMETER_CTRL_CHANNEL = -8, //!< MIDI Control channel
  196. PARAMETER_MAX = -9 //!< Max value, defined for convenience
  197. };
  198. /*!
  199. * Options used in the CarlaEngine::setOption() and set_option() calls.\n
  200. * These options must be set before initiliazing or after closing the engine.
  201. */
  202. enum OptionsType {
  203. /*!
  204. * Try to set the current process name.
  205. * \note Not available on all platforms.
  206. */
  207. OPTION_PROCESS_NAME = 0,
  208. /*!
  209. * Set the engine processing mode.\n
  210. * Default is PROCESS_MODE_CONTINUOUS_RACK.
  211. * \see ProcessMode
  212. */
  213. OPTION_PROCESS_MODE = 1,
  214. /*!
  215. * Set the engine transport mode.\n
  216. * Default is TRANSPORT_MODE_INTERNAL.
  217. * \see TransportMode
  218. */
  219. OPTION_TRANSPORT_MODE = 2,
  220. /*!
  221. * Force mono plugins as stereo, by running 2 instances at the same time.
  222. * \note Not supported by all plugins.
  223. */
  224. OPTION_FORCE_STEREO = 3,
  225. /*!
  226. * Use plugin bridges whenever possible.\n
  227. * Default is no, and not recommended at this point!.
  228. * EXPERIMENTAL AND INCOMPLETE!
  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()
  347. * \see 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. */
  358. CALLBACK_PLUGIN_ADDED = 1,
  359. /*!
  360. * A plugin has been removed.
  361. */
  362. CALLBACK_PLUGIN_REMOVED = 2,
  363. /*!
  364. * A parameter value has been changed.
  365. *
  366. * \param value1 Parameter index
  367. * \param value3 Value
  368. */
  369. CALLBACK_PARAMETER_VALUE_CHANGED = 3,
  370. /*!
  371. * A parameter default has been changed.
  372. *
  373. * \param value1 Parameter index
  374. * \param value3 Default value
  375. */
  376. CALLBACK_PARAMETER_DEFAULT_CHANGED = 4,
  377. /*!
  378. * A parameter's MIDI channel has been changed.
  379. *
  380. * \param value1 Parameter index
  381. * \param value2 MIDI channel
  382. */
  383. CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 5,
  384. /*!
  385. * A parameter's MIDI CC has been changed.
  386. *
  387. * \param value1 Parameter index
  388. * \param value2 MIDI CC
  389. */
  390. CALLBACK_PARAMETER_MIDI_CC_CHANGED = 6,
  391. /*!
  392. * The current program has has been changed.
  393. *
  394. * \param value1 Program index
  395. */
  396. CALLBACK_PROGRAM_CHANGED = 7,
  397. /*!
  398. * The current MIDI program has been changed.
  399. *
  400. * \param value1 MIDI bank
  401. * \param value2 MIDI program
  402. */
  403. CALLBACK_MIDI_PROGRAM_CHANGED = 8,
  404. /*!
  405. * A note has been pressed.
  406. *
  407. * \param value1 Channel
  408. * \param value2 Note
  409. * \param value3 Velocity
  410. */
  411. CALLBACK_NOTE_ON = 9,
  412. /*!
  413. * A note has been released.
  414. *
  415. * \param value1 Channel
  416. * \param value2 Note
  417. */
  418. CALLBACK_NOTE_OFF = 10,
  419. /*!
  420. * The plugin's custom GUI state has changed.
  421. *
  422. * \param value1 State, as follows:.\n
  423. * 0: GUI has been closed or hidden\n
  424. * 1: GUI has been shown\n
  425. * -1: GUI has crashed and should not be shown again
  426. */
  427. CALLBACK_SHOW_GUI = 11,
  428. /*!
  429. * The plugin needs update.
  430. */
  431. CALLBACK_UPDATE = 12,
  432. /*!
  433. * The plugin's data/information has changed.
  434. */
  435. CALLBACK_RELOAD_INFO = 13,
  436. /*!
  437. * The plugin's parameters have changed.
  438. */
  439. CALLBACK_RELOAD_PARAMETERS = 14,
  440. /*!
  441. * The plugin's programs have changed.
  442. */
  443. CALLBACK_RELOAD_PROGRAMS = 15,
  444. /*!
  445. * The plugin's state has changed.
  446. */
  447. CALLBACK_RELOAD_ALL = 16,
  448. /*!
  449. * Canvas client added
  450. *
  451. * \param value1 Client ID
  452. * \param valueStr Client Name
  453. */
  454. CALLBACK_PATCHBAY_CLIENT_ADDED = 17,
  455. /*!
  456. * Canvas client removed
  457. *
  458. * \param value1 Client ID
  459. */
  460. CALLBACK_PATCHBAY_CLIENT_REMOVED = 18,
  461. /*!
  462. * Canvas client renamed
  463. *
  464. * \param value1 Client ID
  465. * \param valueStr New Client name
  466. */
  467. CALLBACK_PATCHBAY_CLIENT_RENAMED = 19,
  468. /*!
  469. * Canvas port added
  470. *
  471. * \param value1 Client ID
  472. * \param value2 Port ID
  473. * \param valueStr Port name
  474. */
  475. CALLBACK_PATCHBAY_PORT_ADDED = 20,
  476. /*!
  477. * Canvas port remvoed
  478. *
  479. * \param value1 Port ID
  480. */
  481. CALLBACK_PATCHBAY_PORT_REMOVED = 21,
  482. /*!
  483. * Canvas port renamed
  484. *
  485. * \param value1 Port ID
  486. * \param valueStr New Port name
  487. */
  488. CALLBACK_PATCHBAY_PORT_RENAMED = 22,
  489. /*!
  490. * Canvas port connection added
  491. *
  492. * \param value1 Output port ID
  493. * \param value2 Input port ID
  494. */
  495. CALLBACK_PATCHBAY_CONNECTION_ADDED = 23,
  496. /*!
  497. * Canvas port connection removed
  498. *
  499. * \param value1 Output port ID
  500. * \param value2 Input port ID
  501. */
  502. CALLBACK_PATCHBAY_CONNECTION_REMOVED = 24,
  503. /*!
  504. * Non-Session-Manager Announce message.
  505. */
  506. CALLBACK_NSM_ANNOUNCE = 25,
  507. /*!
  508. * Non-Session-Manager Open message #1.
  509. */
  510. CALLBACK_NSM_OPEN1 = 26,
  511. /*!
  512. * Non-Session-Manager Open message #2.
  513. */
  514. CALLBACK_NSM_OPEN2 = 27,
  515. /*!
  516. * Non-Session-Manager Save message.
  517. */
  518. CALLBACK_NSM_SAVE = 28,
  519. /*!
  520. * An error occurred, show last error to user.
  521. */
  522. CALLBACK_ERROR = 29,
  523. /*!
  524. * The engine has crashed or malfunctioned and will no longer work.
  525. */
  526. CALLBACK_QUIT = 30
  527. };
  528. /*!
  529. * Engine process mode.
  530. *
  531. * \see OPTION_PROCESS_MODE
  532. */
  533. enum ProcessMode {
  534. PROCESS_MODE_SINGLE_CLIENT = 0, //!< Single client mode (dynamic input/outputs as needed by plugins)
  535. PROCESS_MODE_MULTIPLE_CLIENTS = 1, //!< Multiple client mode (1 master client + 1 client per plugin)
  536. PROCESS_MODE_CONTINUOUS_RACK = 2, //!< Single client, 'rack' mode. Processes plugins in order of id, with forced stereo.
  537. PROCESS_MODE_PATCHBAY = 3, //!< Single client, 'patchbay' mode.
  538. PROCESS_MODE_BRIDGE = 4 //!< Special mode, used in plugin-bridges only. RT buffers come from shared memory in a separate host app.
  539. };
  540. /*!
  541. * All the available transport modes
  542. */
  543. enum TransportMode {
  544. TRANSPORT_MODE_INTERNAL = 0, //!< Internal transport mode.
  545. TRANSPORT_MODE_JACK = 1 //!< JACK transport, only available if driver name is "JACK"
  546. };
  547. /*!
  548. * Callback function the engine will call when something interesting happens.
  549. *
  550. * \see CallbackType and set_callback_function()
  551. */
  552. typedef void (*CallbackFunc)(void* ptr, CallbackType action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr);
  553. /*!
  554. * Parameter data
  555. */
  556. struct ParameterData {
  557. ParameterType type;
  558. int32_t index;
  559. int32_t rindex;
  560. uint32_t hints;
  561. uint8_t midiChannel;
  562. int16_t midiCC;
  563. ParameterData()
  564. : type(PARAMETER_UNKNOWN),
  565. index(-1),
  566. rindex(-1),
  567. hints(0x0),
  568. midiChannel(0),
  569. midiCC(-1) {}
  570. };
  571. /*!
  572. * Parameter ranges
  573. */
  574. struct ParameterRanges {
  575. float def;
  576. float min;
  577. float max;
  578. float step;
  579. float stepSmall;
  580. float stepLarge;
  581. ParameterRanges()
  582. : def(0.0f),
  583. min(0.0f),
  584. max(1.0f),
  585. step(0.01f),
  586. stepSmall(0.0001f),
  587. stepLarge(0.1f) {}
  588. void fixDefault()
  589. {
  590. fixValue(def);
  591. }
  592. void fixValue(float& value) const
  593. {
  594. if (value < min)
  595. value = min;
  596. else if (value > max)
  597. value = max;
  598. }
  599. float fixValue(const float& value) const
  600. {
  601. if (value < min)
  602. return min;
  603. else if (value > max)
  604. return max;
  605. return value;
  606. }
  607. float normalizeValue(const float& value) const
  608. {
  609. return (value - min) / (max - min);
  610. }
  611. float unnormalizeValue(const float& value) const
  612. {
  613. return value * (max - min) + min;
  614. }
  615. };
  616. /*!
  617. * MIDI Program data
  618. */
  619. struct MidiProgramData {
  620. uint32_t bank;
  621. uint32_t program;
  622. const char* name;
  623. MidiProgramData()
  624. : bank(0),
  625. program(0),
  626. name(nullptr) {}
  627. ~MidiProgramData()
  628. {
  629. if (name != nullptr)
  630. delete[] name;
  631. }
  632. };
  633. /*!
  634. * Custom data, saving key:value 'dictionaries'.
  635. * \a type is an URI which defines the \a value type.
  636. *
  637. * \see CustomDataTypes
  638. */
  639. struct CustomData {
  640. const char* type;
  641. const char* key;
  642. const char* value;
  643. CustomData()
  644. : type(nullptr),
  645. key(nullptr),
  646. value(nullptr) {}
  647. ~CustomData()
  648. {
  649. if (type != nullptr)
  650. delete[] type;
  651. if (key != nullptr)
  652. delete[] key;
  653. if (value != nullptr)
  654. delete[] value;
  655. }
  656. };
  657. /**@}*/
  658. // forward declarations of commonly used Carla classes
  659. class CarlaEngine;
  660. class CarlaPlugin;
  661. CARLA_BACKEND_END_NAMESPACE
  662. #endif // __CARLA_BACKEND_HPP__