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.

CarlaBackend.hpp 22KB

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