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.

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