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.

carla_backend.hpp 19KB

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