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.

823 lines
23KB

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