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.

878 lines
25KB

  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 doc/GPL.txt file.
  16. */
  17. #ifndef CARLA_BACKEND_HPP_INCLUDED
  18. #define CARLA_BACKEND_HPP_INCLUDED
  19. #include "CarlaDefines.hpp"
  20. #ifdef CARLA_PROPER_CPP11_SUPPORT
  21. # define SIZE_INT : int
  22. # include <cstdint>
  23. #else
  24. # define SIZE_INT
  25. # include <stdint.h>
  26. #endif
  27. #define CARLA_BACKEND_START_NAMESPACE namespace CarlaBackend {
  28. #define CARLA_BACKEND_END_NAMESPACE }
  29. #define CARLA_BACKEND_USE_NAMESPACE using namespace CarlaBackend;
  30. #define STR_MAX 0xFF
  31. CARLA_BACKEND_START_NAMESPACE
  32. /*!
  33. * @defgroup CarlaBackendAPI Carla Backend API
  34. *
  35. * The Carla Backend API.\n
  36. * This is the base definitions for everything in the Carla code.
  37. * @{
  38. */
  39. const unsigned int MAX_DEFAULT_PLUGINS = 99; //!< Maximum default number of loadable plugins.
  40. const unsigned int MAX_RACK_PLUGINS = 16; //!< Maximum number of loadable plugins in rack mode.
  41. const unsigned int MAX_PATCHBAY_PLUGINS = 255; //!< Maximum number of loadable plugins in patchbay mode.
  42. const unsigned int MAX_DEFAULT_PARAMETERS = 200; //!< Maximum default number of parameters allowed.\see ENGINE_OPTION_MAX_PARAMETERS
  43. /*!
  44. * @defgroup EngineDriverHints Engine Driver Hints
  45. *
  46. * Various engine driver hints.
  47. * @{
  48. */
  49. const unsigned int ENGINE_DRIVER_HAS_CONTROL_PANEL = 0x1; //!< Engine driver has custom control-panel.
  50. const unsigned int ENGINE_DRIVER_VARIABLE_BUFFER_SIZE = 0x2; //!< Engine driver can change buffer-size on the fly.
  51. const unsigned int ENGINE_DRIVER_VARIABLE_SAMPLE_RATE = 0x4; //!< Engine driver can change sample-rate on the fly.
  52. /**@}*/
  53. /*!
  54. * @defgroup PluginHints Plugin Hints
  55. *
  56. * Various plugin hints.
  57. * \see CarlaPlugin::hints()
  58. * @{
  59. */
  60. const unsigned int PLUGIN_IS_BRIDGE = 0x001; //!< Plugin is a bridge. This hint is required because "bridge" itself is not a plugin type.
  61. const unsigned int PLUGIN_IS_RTSAFE = 0x002; //!< Plugin is hard real-time safe.
  62. const unsigned int PLUGIN_IS_SYNTH = 0x004; //!< Plugin is hard real-time safe.
  63. const unsigned int PLUGIN_HAS_GUI = 0x008; //!< Plugin has its own custom GUI.
  64. const unsigned int PLUGIN_CAN_DRYWET = 0x010; //!< Plugin can use internal Dry/Wet control.
  65. const unsigned int PLUGIN_CAN_VOLUME = 0x020; //!< Plugin can use internal Volume control.
  66. const unsigned int PLUGIN_CAN_BALANCE = 0x040; //!< Plugin can use internal Left & Right Balance controls.
  67. const unsigned int PLUGIN_CAN_PANNING = 0x080; //!< Plugin can use internal Panning control.
  68. const unsigned int PLUGIN_NEEDS_FIXED_BUFFERS = 0x100; //!< Plugin needs constant/fixed-size audio buffers.
  69. const unsigned int PLUGIN_NEEDS_SINGLE_THREAD = 0x200; //!< Plugin needs a single thread for all UI events.
  70. /**@}*/
  71. /*!
  72. * @defgroup PluginOptions Plugin Options
  73. *
  74. * Various plugin options.
  75. * \see CarlaPlugin::availableOptions() and CarlaPlugin::options()
  76. * @{
  77. */
  78. const unsigned int PLUGIN_OPTION_FIXED_BUFFERS = 0x001; //!< Use constant/fixed-size audio buffers.
  79. const unsigned int PLUGIN_OPTION_FORCE_STEREO = 0x002; //!< Force mono plugin as stereo.
  80. const unsigned int PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004; //!< Map MIDI-Programs to plugin programs.
  81. const unsigned int PLUGIN_OPTION_USE_CHUNKS = 0x008; //!< Use chunks to save&restore data.
  82. const unsigned int PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010; //!< Send MIDI control change events.
  83. const unsigned int PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020; //!< Send MIDI channel pressure events.
  84. const unsigned int PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040; //!< Send MIDI note aftertouch events.
  85. const unsigned int PLUGIN_OPTION_SEND_PITCHBEND = 0x080; //!< Send MIDI pitchbend events.
  86. const unsigned int PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100; //!< Send MIDI all-sounds/notes-off events, single note-offs otherwise.
  87. /**@}*/
  88. /*!
  89. * @defgroup ParameterHints Parameter Hints
  90. *
  91. * Various parameter hints.
  92. * \see CarlaPlugin::parameterData()
  93. * @{
  94. */
  95. const unsigned int PARAMETER_IS_BOOLEAN = 0x001; //!< Parameter values are boolean (always at minimum or maximum values).
  96. const unsigned int PARAMETER_IS_INTEGER = 0x002; //!< Parameter values are integer.
  97. const unsigned int PARAMETER_IS_LOGARITHMIC = 0x004; //!< Parameter values are logarithmic.
  98. const unsigned int PARAMETER_IS_ENABLED = 0x010; //!< Parameter is enabled (can be viewed, changed and stored).
  99. const unsigned int PARAMETER_IS_AUTOMABLE = 0x020; //!< Parameter is automable (realtime safe).
  100. const unsigned int PARAMETER_IS_READ_ONLY = 0x040; //!< Parameter is read-only.
  101. const unsigned int PARAMETER_USES_SAMPLERATE = 0x100; //!< Parameter needs sample rate to work (value and ranges are multiplied by SR on usage, divided by SR on save).
  102. const unsigned int PARAMETER_USES_SCALEPOINTS = 0x200; //!< Parameter uses scalepoints to define internal values in a meaningful way.
  103. const unsigned int PARAMETER_USES_CUSTOM_TEXT = 0x400; //!< Parameter uses custom text for displaying its value.\see CarlaPlugin::getParameterText()
  104. /**@}*/
  105. /*!
  106. * @defgroup CustomDataTypes Custom Data Types
  107. *
  108. * The type defines how the \param value in the CustomData struct is stored.\n
  109. * Types are valid URIs. Any non-string or non-simple type (not integral) is saved in a base64 encoded format.
  110. * \see CustomData
  111. * @{
  112. */
  113. const char* const CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"; //!< Chunk type URI.
  114. const char* const CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string"; //!< String type URI.
  115. /**@}*/
  116. /*!
  117. * @defgroup CustomDataKeys Custom Data Keys
  118. *
  119. * \see CustomData
  120. * @{
  121. */
  122. const char* const CUSTOM_DATA_KEY_OPTIONS = "CarlaOptions"; //!< Options URI.
  123. const char* const CUSTOM_DATA_KEY_UI_X = "CarlaUI:X"; //!< UI X URI.
  124. const char* const CUSTOM_DATA_KEY_UI_Y = "CarlaUI:Y"; //!< UI Y URI.
  125. const char* const CUSTOM_DATA_KEY_UI_WIDTH = "CarlaUI:Width"; //!< UI width URI.
  126. const char* const CUSTOM_DATA_KEY_UI_HEIGHT = "CarlaUI:Height"; //!< UI height URI.
  127. const char* const CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUI:Visible"; //!< UI visible URI.
  128. /**@}*/
  129. /*!
  130. * @defgroup PatchbayPortHints Patchbay Port Hints
  131. *
  132. * Various patchbay port hints.
  133. * @{
  134. */
  135. const unsigned int PATCHBAY_PORT_IS_INPUT = 0x01; //!< Patchbay port is input.
  136. const unsigned int PATCHBAY_PORT_IS_OUTPUT = 0x02; //!< Patchbay port is output.
  137. const unsigned int PATCHBAY_PORT_IS_AUDIO = 0x10; //!< Patchbay port is of Audio type.
  138. const unsigned int PATCHBAY_PORT_IS_CV = 0x20; //!< Patchbay port is of CV type.
  139. const unsigned int PATCHBAY_PORT_IS_MIDI = 0x40; //!< Patchbay port is of MIDI type.
  140. /**@}*/
  141. /*!
  142. * The binary type of a plugin.
  143. */
  144. enum BinaryType SIZE_INT {
  145. BINARY_NONE = 0, //!< Null binary type.
  146. BINARY_POSIX32 = 1, //!< POSIX 32bit.
  147. BINARY_POSIX64 = 2, //!< POSIX 64bit.
  148. BINARY_WIN32 = 3, //!< Windows 32bit.
  149. BINARY_WIN64 = 4, //!< Windows 64bit.
  150. BINARY_OTHER = 5 //!< Other.
  151. };
  152. /*!
  153. * All the available plugin types, provided by subclasses of CarlaPlugin.\n
  154. * Some plugin classes might provide more than 1 plugin type.
  155. */
  156. enum PluginType SIZE_INT {
  157. PLUGIN_NONE = 0, //!< Null plugin type.
  158. PLUGIN_INTERNAL = 1, //!< Internal plugin.
  159. PLUGIN_LADSPA = 2, //!< LADSPA plugin.
  160. PLUGIN_DSSI = 3, //!< DSSI plugin.
  161. PLUGIN_LV2 = 4, //!< LV2 plugin.
  162. PLUGIN_VST = 5, //!< VST plugin.
  163. PLUGIN_AU = 6, //!< AU plugin.
  164. PLUGIN_CSOUND = 7, //!< Csound file.
  165. PLUGIN_GIG = 8, //!< GIG sound kit.
  166. PLUGIN_SF2 = 9, //!< SF2 sound kit (aka SoundFont).
  167. PLUGIN_SFZ = 10 //!< SFZ sound kit.
  168. };
  169. /*!
  170. * Plugin category, describing the funtionality of a plugin.\n
  171. * When a plugin fails to tell its own category, one is atributted to it based on its name.
  172. */
  173. enum PluginCategory SIZE_INT {
  174. PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category.
  175. PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator.
  176. PLUGIN_CATEGORY_DELAY = 2, //!< A delay or reverberator.
  177. PLUGIN_CATEGORY_EQ = 3, //!< An equalizer.
  178. PLUGIN_CATEGORY_FILTER = 4, //!< A filter.
  179. PLUGIN_CATEGORY_DISTORTION = 5, //!< A distortion plugin.
  180. PLUGIN_CATEGORY_DYNAMICS = 6, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc).
  181. PLUGIN_CATEGORY_MODULATOR = 7, //!< A 'modulator' plugin (chorus, flanger, phaser, etc).
  182. PLUGIN_CATEGORY_UTILITY = 8, //!< An 'utility' plugin (analyzer, converter, mixer, etc).
  183. PLUGIN_CATEGORY_OTHER = 9 //!< Misc plugin (used to check if the plugin has a category).
  184. };
  185. /*!
  186. * Plugin parameter type.
  187. */
  188. enum ParameterType SIZE_INT {
  189. PARAMETER_UNKNOWN = 0, //!< Null parameter type.
  190. PARAMETER_INPUT = 1, //!< Input parameter.
  191. PARAMETER_OUTPUT = 2, //!< Ouput parameter.
  192. PARAMETER_SPECIAL = 3 //!< Special parameter, used to report info in LADSPA, DSSI or LV2 plugins.
  193. };
  194. /*!
  195. * Internal parameter indexes.\n
  196. * These are special parameters used internally, plugins do not know about their existence.
  197. */
  198. enum InternalParameterIndex SIZE_INT {
  199. PARAMETER_NULL = -1, //!< Null parameter.
  200. PARAMETER_ACTIVE = -2, //!< Active parameter, can only be 'true' or 'false'; default is 'false'.
  201. PARAMETER_DRYWET = -3, //!< Dry/Wet parameter, range 0.0...1.0; default is 1.0.
  202. PARAMETER_VOLUME = -4, //!< Volume parameter, range 0.0...1.27; default is 1.0.
  203. PARAMETER_BALANCE_LEFT = -5, //!< Stereo Balance-Left parameter, range -1.0...1.0; default is -1.0.
  204. PARAMETER_BALANCE_RIGHT = -6, //!< Stereo Balance-Right parameter, range -1.0...1.0; default is 1.0.
  205. PARAMETER_PANNING = -7, //!< Mono Panning parameter, range -1.0...1.0; default is 0.0.
  206. PARAMETER_CTRL_CHANNEL = -8, //!< MIDI Control channel, range -1...15 (-1 = off).
  207. PARAMETER_MAX = -9 //!< Max value, defined for convenience.
  208. };
  209. /*!
  210. * Opcodes sent from the engine callback to the GUI, as defined by EngineCallbackFunc.
  211. * \see CarlaEngine::setCallback()
  212. */
  213. enum EngineCallbackOpcode SIZE_INT {
  214. /*!
  215. * Debug.\n
  216. * This opcode is undefined and used only for testing purposes.
  217. */
  218. ENGINE_CALLBACK_DEBUG = 0,
  219. /*!
  220. * A plugin has been added.
  221. * \param valueStr Plugin name
  222. */
  223. ENGINE_CALLBACK_PLUGIN_ADDED = 1,
  224. /*!
  225. * A plugin has been removed.
  226. */
  227. ENGINE_CALLBACK_PLUGIN_REMOVED = 2,
  228. /*!
  229. * A plugin has been renamed.
  230. * \param valueStr New plugin name
  231. */
  232. ENGINE_CALLBACK_PLUGIN_RENAMED = 3,
  233. /*!
  234. * A plugin has been disabled.
  235. * \param valueStr Error details
  236. */
  237. ENGINE_CALLBACK_PLUGIN_DISABLED = 4,
  238. /*!
  239. * A parameter value has been changed.
  240. * \param value1 Parameter index
  241. * \param value3 Parameter value
  242. */
  243. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5,
  244. /*!
  245. * A parameter default has changed.
  246. * \param value1 Parameter index
  247. * \param value3 New default value
  248. */
  249. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6,
  250. /*!
  251. * A parameter's MIDI channel has been changed.
  252. * \param value1 Parameter index
  253. * \param value2 MIDI channel
  254. */
  255. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 7,
  256. /*!
  257. * A parameter's MIDI CC has been changed.
  258. * \param value1 Parameter index
  259. * \param value2 MIDI CC
  260. */
  261. ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED = 8,
  262. /*!
  263. * The current program has has been changed.
  264. * \param value1 Program index
  265. */
  266. ENGINE_CALLBACK_PROGRAM_CHANGED = 9,
  267. /*!
  268. * The current MIDI program has been changed.
  269. * \param value1 MIDI bank
  270. * \param value2 MIDI program
  271. */
  272. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 10,
  273. /*!
  274. * The plugin's custom UI state has changed.
  275. * \param value1 State, as follows:\n
  276. * 0: UI has been closed or hidden\n
  277. * 1: UI has been shown\n
  278. * -1: UI has crashed and should not be shown again
  279. */
  280. ENGINE_CALLBACK_UI_STATE_CHANGED = 11,
  281. /*!
  282. * A note has been pressed.
  283. * \param value1 Channel
  284. * \param value2 Note
  285. * \param value3 Velocity
  286. */
  287. ENGINE_CALLBACK_NOTE_ON = 12,
  288. /*!
  289. * A note has been released.
  290. * \param value1 Channel
  291. * \param value2 Note
  292. */
  293. ENGINE_CALLBACK_NOTE_OFF = 13,
  294. /*!
  295. * The plugin needs update.
  296. */
  297. ENGINE_CALLBACK_UPDATE = 14,
  298. /*!
  299. * The plugin's data/information has changed.
  300. */
  301. ENGINE_CALLBACK_RELOAD_INFO = 15,
  302. /*!
  303. * The plugin's parameters have changed.
  304. */
  305. ENGINE_CALLBACK_RELOAD_PARAMETERS = 16,
  306. /*!
  307. * The plugin's programs have changed.
  308. */
  309. ENGINE_CALLBACK_RELOAD_PROGRAMS = 17,
  310. /*!
  311. * The plugin's state has changed.
  312. */
  313. ENGINE_CALLBACK_RELOAD_ALL = 18,
  314. /*!
  315. * Canvas client added.
  316. * \param pluginId Client Id
  317. * \param valueStr Client name
  318. */
  319. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 19,
  320. /*!
  321. * Canvas client removed.
  322. * \param pluginId Client Id
  323. */
  324. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 20,
  325. /*!
  326. * Canvas client renamed.
  327. * \param pluginId Client Id
  328. * \param valueStr New client name
  329. */
  330. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 21,
  331. /*!
  332. * Canvas port added.
  333. * \param pluginId Client Id
  334. * \param value1 Port Id
  335. * \param value2 Port flags
  336. * \param valueStr Port name
  337. */
  338. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 22,
  339. /*!
  340. * Canvas port removed.
  341. * \param pluginId Client Id
  342. * \param value1 Port Id
  343. */
  344. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 23,
  345. /*!
  346. * Canvas port renamed.
  347. * \param pluginId Client Id
  348. * \param value1 Port Id
  349. * \param valueStr New port name
  350. */
  351. ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 24,
  352. /*!
  353. * Canvas port connection added.
  354. * \param value1 Output port Id
  355. * \param value2 Input port Id
  356. */
  357. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 25,
  358. /*!
  359. * Canvas port connection removed.
  360. * \param value1 Output port Id
  361. * \param value2 Input port Id
  362. */
  363. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 26,
  364. /*!
  365. * Canvas client icon changed.
  366. * \param pluginId Client Id
  367. * \param valueStr New icon name
  368. */
  369. ENGINE_CALLBACK_PATCHBAY_ICON_CHANGED = 27,
  370. /*!
  371. * Engine buffer-size changed.
  372. * \param value1 New buffer size
  373. */
  374. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 28,
  375. /*!
  376. * Engine sample-rate changed.
  377. * \param value3 New sample rate
  378. */
  379. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 29,
  380. /*!
  381. * Engine process mode changed.
  382. * \param value1 New process mode
  383. * \see ProcessMode
  384. */
  385. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 30,
  386. /*!
  387. * Engine started.
  388. * \param valuestr Engine driver
  389. */
  390. ENGINE_CALLBACK_ENGINE_STARTED = 31,
  391. /*!
  392. * Engine stopped.
  393. */
  394. ENGINE_CALLBACK_ENGINE_STOPPED = 32,
  395. /*!
  396. * Non-Session-Manager Announce message.
  397. */
  398. ENGINE_CALLBACK_NSM_ANNOUNCE = 33,
  399. /*!
  400. * Non-Session-Manager Open message.
  401. */
  402. ENGINE_CALLBACK_NSM_OPEN = 34,
  403. /*!
  404. * Non-Session-Manager Save message.
  405. */
  406. ENGINE_CALLBACK_NSM_SAVE = 35,
  407. /*!
  408. * Show \a valueStr as info to user.
  409. */
  410. ENGINE_CALLBACK_INFO = 36,
  411. /*!
  412. * Show \a valueStr as an error to user.
  413. */
  414. ENGINE_CALLBACK_ERROR = 37,
  415. /*!
  416. * The engine has crashed or malfunctioned and will no longer work.
  417. */
  418. ENGINE_CALLBACK_QUIT = 38
  419. };
  420. /*!
  421. * Options used in the CarlaEngine::setOption() calls.\n
  422. * All options except paths must be set before initiliazing or after closing the engine.
  423. */
  424. enum EngineOption SIZE_INT {
  425. /*!
  426. * Set the current process name.\n
  427. * This is a convenience option, as Python lacks this functionality.
  428. */
  429. ENGINE_OPTION_PROCESS_NAME = 0,
  430. /*!
  431. * Set the engine processing mode.\n
  432. * Default is PROCESS_MODE_MULTIPLE_CLIENTS on Linux and PROCESS_MODE_CONTINUOUS_RACK for all other OSes.
  433. * \see ProcessMode
  434. */
  435. ENGINE_OPTION_PROCESS_MODE = 1,
  436. /*!
  437. * Set the engine transport mode.\n
  438. * Default is TRANSPORT_MODE_INTERNAL.
  439. * \see TransportMode
  440. */
  441. ENGINE_OPTION_TRANSPORT_MODE = 2,
  442. /*!
  443. * Force mono plugins as stereo, by running 2 instances at the same time.
  444. * \note Not supported by all plugins.
  445. * \see PLUGIN_OPTION_FORCE_STEREO
  446. */
  447. ENGINE_OPTION_FORCE_STEREO = 3,
  448. /*!
  449. * Use plugin bridges whenever possible.\n
  450. * Default is no, EXPERIMENTAL.
  451. */
  452. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4,
  453. /*!
  454. * Use UI bridges whenever possible, otherwise UIs will be handled in the main thread.\n
  455. * Default is yes.
  456. */
  457. ENGINE_OPTION_PREFER_UI_BRIDGES = 5,
  458. /*!
  459. * Make plugin UIs always-on-top.\n
  460. * Default is yes.
  461. */
  462. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6,
  463. /*!
  464. * Maximum number of parameters allowed.\n
  465. * Default is MAX_DEFAULT_PARAMETERS.
  466. */
  467. ENGINE_OPTION_MAX_PARAMETERS = 7,
  468. /*!
  469. * Timeout value in ms for how much to wait for UI-Bridges to respond.\n
  470. * Default is 4000 (4 secs).
  471. */
  472. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8,
  473. /*!
  474. * Audio number of periods.
  475. */
  476. ENGINE_OPTION_AUDIO_NUM_PERIODS = 9,
  477. /*!
  478. * Audio buffer size.
  479. */
  480. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10,
  481. /*!
  482. * Audio sample rate.
  483. */
  484. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11,
  485. /*!
  486. * Audio device.
  487. */
  488. ENGINE_OPTION_AUDIO_DEVICE = 12,
  489. /*!
  490. * Set path to the resource files.\n
  491. * Default unset.
  492. *
  493. * \note Must be set for some internal plugins to work!
  494. */
  495. ENGINE_OPTION_PATH_RESOURCES = 13,
  496. #ifndef BUILD_BRIDGE
  497. /*!
  498. * Set path to the native plugin bridge executable.\n
  499. * Default unset.
  500. */
  501. ENGINE_OPTION_PATH_BRIDGE_NATIVE = 14,
  502. /*!
  503. * Set path to the POSIX 32bit plugin bridge executable.\n
  504. * Default unset.
  505. */
  506. ENGINE_OPTION_PATH_BRIDGE_POSIX32 = 15,
  507. /*!
  508. * Set path to the POSIX 64bit plugin bridge executable.\n
  509. * Default unset.
  510. */
  511. ENGINE_OPTION_PATH_BRIDGE_POSIX64 = 16,
  512. /*!
  513. * Set path to the Windows 32bit plugin bridge executable.\n
  514. * Default unset.
  515. */
  516. ENGINE_OPTION_PATH_BRIDGE_WIN32 = 17,
  517. /*!
  518. * Set path to the Windows 64bit plugin bridge executable.\n
  519. * Default unset.
  520. */
  521. ENGINE_OPTION_PATH_BRIDGE_WIN64 = 18,
  522. #endif
  523. #ifdef WANT_LV2
  524. /*!
  525. * Set path to the LV2 External UI bridge executable.\n
  526. * Default unset.
  527. */
  528. ENGINE_OPTION_PATH_BRIDGE_LV2_EXTERNAL = 19,
  529. /*!
  530. * Set path to the LV2 Gtk2 UI bridge executable.\n
  531. * Default unset.
  532. */
  533. ENGINE_OPTION_PATH_BRIDGE_LV2_GTK2 = 20,
  534. /*!
  535. * Set path to the LV2 Gtk3 UI bridge executable.\n
  536. * Default unset.
  537. */
  538. ENGINE_OPTION_PATH_BRIDGE_LV2_GTK3 = 21,
  539. /*!
  540. * Set path to the LV2 Ntk UI bridge executable.\n
  541. * Default unset.
  542. */
  543. ENGINE_OPTION_PATH_BRIDGE_LV2_NTK = 22,
  544. /*!
  545. * Set path to the LV2 Qt4 UI bridge executable.\n
  546. * Default unset.
  547. */
  548. ENGINE_OPTION_PATH_BRIDGE_LV2_QT4 = 23,
  549. /*!
  550. * Set path to the LV2 Qt5 UI bridge executable.\n
  551. * Default unset.
  552. */
  553. ENGINE_OPTION_PATH_BRIDGE_LV2_QT5 = 24,
  554. /*!
  555. * Set path to the LV2 Cocoa UI bridge executable.\n
  556. * Default unset.
  557. */
  558. ENGINE_OPTION_PATH_BRIDGE_LV2_COCOA = 25,
  559. /*!
  560. * Set path to the LV2 Windows UI bridge executable.\n
  561. * Default unset.
  562. */
  563. ENGINE_OPTION_PATH_BRIDGE_LV2_WINDOWS = 26,
  564. /*!
  565. * Set path to the LV2 X11 UI bridge executable.\n
  566. * Default unset.
  567. */
  568. ENGINE_OPTION_PATH_BRIDGE_LV2_X11 = 27,
  569. #endif
  570. #ifdef WANT_VST
  571. /*!
  572. * Set path to the VST Mac UI bridge executable.\n
  573. * Default unset.
  574. */
  575. ENGINE_OPTION_PATH_BRIDGE_VST_MAC = 28,
  576. /*!
  577. * Set path to the VST HWND UI bridge executable.\n
  578. * Default unset.
  579. */
  580. ENGINE_OPTION_PATH_BRIDGE_VST_HWND = 29,
  581. /*!
  582. * Set path to the VST X11 UI bridge executable.\n
  583. * Default unset.
  584. */
  585. ENGINE_OPTION_PATH_BRIDGE_VST_X11 = 30
  586. #endif
  587. };
  588. /*!
  589. * Engine process mode.
  590. * \see ENGINE_OPTION_PROCESS_MODE
  591. */
  592. enum EngineProcessMode SIZE_INT {
  593. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0, //!< Single client mode (dynamic input/outputs as needed by plugins).
  594. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1, //!< Multiple client mode (1 master client + 1 client per plugin).
  595. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2, //!< Single client, 'rack' mode. Processes plugins in order of Id, with forced stereo.
  596. ENGINE_PROCESS_MODE_PATCHBAY = 3, //!< Single client, 'patchbay' mode.
  597. ENGINE_PROCESS_MODE_BRIDGE = 4 //!< Special mode, used in plugin-bridges only.
  598. };
  599. /*!
  600. * All the available transport modes
  601. */
  602. enum EngineTransportMode SIZE_INT {
  603. ENGINE_TRANSPORT_MODE_INTERNAL = 0, //!< Internal transport mode.
  604. ENGINE_TRANSPORT_MODE_JACK = 1, //!< Transport from JACK, only available if driver name is "JACK".
  605. ENGINE_TRANSPORT_MODE_PLUGIN = 2, //!< Transport from host, used when Carla is a plugin.
  606. ENGINE_TRANSPORT_MODE_BRIDGE = 3 //!< Special mode, used in plugin-bridges only.
  607. };
  608. /*!
  609. * Opcodes sent from the backend to the frontend, asking for file related tasks.
  610. */
  611. enum FileCallbackOpcode SIZE_INT {
  612. /*!
  613. * Debug.\n
  614. * This opcode is undefined and used only for testing purposes.
  615. */
  616. FILE_CALLBACK_DEBUG = 0,
  617. /*!
  618. * Open file or folder.
  619. */
  620. FILE_CALLBACK_OPEN = 1,
  621. /*!
  622. * Save file or folder.
  623. */
  624. FILE_CALLBACK_SAVE = 2
  625. };
  626. /*!
  627. * Engine callback function.
  628. * \see EngineCallbackType
  629. */
  630. typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr);
  631. /*!
  632. * File callback function.
  633. * \see FileCallbackType
  634. */
  635. typedef const char* (*FileCallbackFunc)(void* ptr, FileCallbackOpcode action, bool isDir, const char* title, const char* filter);
  636. /*!
  637. * Parameter data.
  638. */
  639. struct ParameterData {
  640. ParameterType type;
  641. int32_t index;
  642. int32_t rindex;
  643. unsigned int hints;
  644. uint8_t midiChannel;
  645. int16_t midiCC;
  646. #ifndef DOXYGEN
  647. ParameterData() noexcept
  648. : type(PARAMETER_UNKNOWN),
  649. index(PARAMETER_NULL),
  650. rindex(-1),
  651. hints(0x0),
  652. midiChannel(0),
  653. midiCC(-1) {}
  654. #endif
  655. };
  656. /*!
  657. * Parameter ranges.
  658. */
  659. struct ParameterRanges {
  660. float def;
  661. float min;
  662. float max;
  663. float step;
  664. float stepSmall;
  665. float stepLarge;
  666. #ifndef DOXYGEN
  667. ParameterRanges() noexcept
  668. : def(0.0f),
  669. min(0.0f),
  670. max(1.0f),
  671. step(0.01f),
  672. stepSmall(0.0001f),
  673. stepLarge(0.1f) {}
  674. #endif
  675. void fixDefault() noexcept
  676. {
  677. fixValue(def);
  678. }
  679. void fixValue(float& value) const noexcept
  680. {
  681. if (value <= min)
  682. value = min;
  683. else if (value > max)
  684. value = max;
  685. }
  686. float getFixedValue(const float& value) const noexcept
  687. {
  688. if (value <= min)
  689. return min;
  690. if (value >= max)
  691. return max;
  692. return value;
  693. }
  694. float getNormalizedValue(const float& value) const noexcept
  695. {
  696. const float normValue((value - min) / (max - min));
  697. if (normValue <= 0.0f)
  698. return 0.0f;
  699. if (normValue >= 1.0f)
  700. return 1.0f;
  701. return normValue;
  702. }
  703. float getFixedAndNormalizedValue(const float& value) const noexcept
  704. {
  705. if (value <= min)
  706. return 0.0f;
  707. if (value >= max)
  708. return 1.0f;
  709. const float normValue((value - min) / (max - min));
  710. if (normValue <= 0.0f)
  711. return 0.0f;
  712. if (normValue >= 1.0f)
  713. return 1.0f;
  714. return normValue;
  715. }
  716. float getUnnormalizedValue(const float& value) const noexcept
  717. {
  718. return value * (max - min) + min;
  719. }
  720. };
  721. /*!
  722. * MIDI Program data.
  723. */
  724. struct MidiProgramData {
  725. uint32_t bank;
  726. uint32_t program;
  727. const char* name;
  728. #ifndef DOXYGEN
  729. MidiProgramData() noexcept
  730. : bank(0),
  731. program(0),
  732. name(nullptr) {}
  733. #endif
  734. };
  735. /*!
  736. * Custom data, for saving key:value 'dictionaries'.\n
  737. * \a type is an URI which defines the \a value type.
  738. * \see CustomDataTypes
  739. */
  740. struct CustomData {
  741. const char* type;
  742. const char* key;
  743. const char* value;
  744. #ifndef DOXYGEN
  745. CustomData() noexcept
  746. : type(nullptr),
  747. key(nullptr),
  748. value(nullptr) {}
  749. #endif
  750. };
  751. /**@}*/
  752. // forward declarations of commonly used Carla classes
  753. class CarlaEngine;
  754. class CarlaPlugin;
  755. CARLA_BACKEND_END_NAMESPACE
  756. #undef SIZE_INT
  757. #endif // CARLA_BACKEND_HPP_INCLUDED