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.h 45KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
11 years ago
10 years ago
10 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
11 years ago
10 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
10 years ago
10 years ago
10 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987
  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-2022 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_H_INCLUDED
  18. #define CARLA_BACKEND_H_INCLUDED
  19. #include "CarlaDefines.h"
  20. #ifdef CARLA_PROPER_CPP11_SUPPORT
  21. # include <cstdint>
  22. #else
  23. # include <stdint.h>
  24. #endif
  25. #define STR_MAX 0xFF
  26. #ifndef CARLA_BACKEND_NAMESPACE
  27. # define CARLA_BACKEND_NAMESPACE CarlaBackend
  28. #endif
  29. #ifdef __cplusplus
  30. # define CARLA_BACKEND_START_NAMESPACE namespace CARLA_BACKEND_NAMESPACE {
  31. # define CARLA_BACKEND_END_NAMESPACE }
  32. # define CARLA_BACKEND_USE_NAMESPACE using namespace CARLA_BACKEND_NAMESPACE;
  33. # include <algorithm>
  34. # include <cmath>
  35. # include <limits>
  36. /* Start namespace */
  37. CARLA_BACKEND_START_NAMESPACE
  38. #endif
  39. /*!
  40. * @defgroup CarlaBackendAPI Carla Backend API
  41. *
  42. * The Carla Backend API.
  43. *
  44. * These are the base definitions for everything in the Carla backend code.
  45. * @{
  46. */
  47. /* ------------------------------------------------------------------------------------------------------------
  48. * Carla Backend API (base definitions) */
  49. /*!
  50. * Maximum default number of loadable plugins.
  51. */
  52. static const uint MAX_DEFAULT_PLUGINS = 512;
  53. /*!
  54. * Maximum number of loadable plugins in rack mode.
  55. */
  56. static const uint MAX_RACK_PLUGINS = 64;
  57. /*!
  58. * Maximum number of loadable plugins in patchbay mode.
  59. */
  60. static const uint MAX_PATCHBAY_PLUGINS = 255;
  61. /*!
  62. * Maximum default number of parameters allowed.
  63. * @see ENGINE_OPTION_MAX_PARAMETERS
  64. */
  65. static const uint MAX_DEFAULT_PARAMETERS = 200;
  66. /*!
  67. * The "plugin Id" for the global Carla instance.
  68. * Currently only used for audio peaks.
  69. */
  70. static const uint MAIN_CARLA_PLUGIN_ID = 0xFFFF;
  71. /* ------------------------------------------------------------------------------------------------------------
  72. * Engine Driver Device Hints */
  73. /*!
  74. * @defgroup EngineDriverHints Engine Driver Device Hints
  75. *
  76. * Various engine driver device hints.
  77. * @see CarlaEngine::getHints(), CarlaEngine::getDriverDeviceInfo() and carla_get_engine_driver_device_info()
  78. * @{
  79. */
  80. /*!
  81. * Engine driver device has custom control-panel.
  82. */
  83. static const uint ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1;
  84. /*!
  85. * Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
  86. * @see ENGINE_OPTION_AUDIO_NUM_PERIODS
  87. */
  88. static const uint ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2;
  89. /*!
  90. * Engine driver device can change buffer-size on the fly.
  91. * @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
  92. */
  93. static const uint ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4;
  94. /*!
  95. * Engine driver device can change sample-rate on the fly.
  96. * @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
  97. */
  98. static const uint ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8;
  99. /** @} */
  100. /* ------------------------------------------------------------------------------------------------------------
  101. * Plugin Hints */
  102. /*!
  103. * @defgroup PluginHints Plugin Hints
  104. *
  105. * Various plugin hints.
  106. * @see CarlaPlugin::getHints() and carla_get_plugin_info()
  107. * @{
  108. */
  109. /*!
  110. * Plugin is a bridge.
  111. * This hint is required because "bridge" itself is not a plugin type.
  112. */
  113. static const uint PLUGIN_IS_BRIDGE = 0x001;
  114. /*!
  115. * Plugin is hard real-time safe.
  116. */
  117. static const uint PLUGIN_IS_RTSAFE = 0x002;
  118. /*!
  119. * Plugin is a synth (produces sound).
  120. */
  121. static const uint PLUGIN_IS_SYNTH = 0x004;
  122. /*!
  123. * Plugin has its own custom UI.
  124. * @see CarlaPlugin::showCustomUI() and carla_show_custom_ui()
  125. */
  126. static const uint PLUGIN_HAS_CUSTOM_UI = 0x008;
  127. /*!
  128. * Plugin can use internal Dry/Wet control.
  129. */
  130. static const uint PLUGIN_CAN_DRYWET = 0x010;
  131. /*!
  132. * Plugin can use internal Volume control.
  133. */
  134. static const uint PLUGIN_CAN_VOLUME = 0x020;
  135. /*!
  136. * Plugin can use internal (Stereo) Balance controls.
  137. */
  138. static const uint PLUGIN_CAN_BALANCE = 0x040;
  139. /*!
  140. * Plugin can use internal (Mono) Panning control.
  141. */
  142. static const uint PLUGIN_CAN_PANNING = 0x080;
  143. /*!
  144. * Plugin needs a constant, fixed-size audio buffer.
  145. */
  146. static const uint PLUGIN_NEEDS_FIXED_BUFFERS = 0x100;
  147. /*!
  148. * Plugin needs to receive all UI events in the main thread.
  149. */
  150. static const uint PLUGIN_NEEDS_UI_MAIN_THREAD = 0x200;
  151. /*!
  152. * Plugin uses 1 program per MIDI channel.
  153. * @note: Only used in some internal plugins and sf2 files.
  154. */
  155. static const uint PLUGIN_USES_MULTI_PROGS = 0x400;
  156. /*!
  157. * Plugin can make use of inline display API.
  158. */
  159. static const uint PLUGIN_HAS_INLINE_DISPLAY = 0x800;
  160. /*!
  161. * Plugin has its own custom UI which can be embed into another Window.
  162. * @see CarlaPlugin::embedCustomUI() and carla_embed_custom_ui()
  163. * @note This is very experimental and subject to change at this point
  164. */
  165. static const uint PLUGIN_HAS_CUSTOM_EMBED_UI = 0x1000;
  166. /*!
  167. * Plugin custom UI is a fake one that simply invokes an open file browser dialog.
  168. */
  169. static const uint PLUGIN_HAS_CUSTOM_UI_USING_FILE_OPEN = 0x2000;
  170. /** @} */
  171. /* ------------------------------------------------------------------------------------------------------------
  172. * Plugin Options */
  173. /*!
  174. * @defgroup PluginOptions Plugin Options
  175. *
  176. * Various plugin options.
  177. * @note Do not modify these values, as they are saved as-is in project files.
  178. * @see CarlaPlugin::getOptionsAvailable(), CarlaPlugin::getOptionsEnabled(), carla_get_plugin_info() and carla_set_option()
  179. * @{
  180. */
  181. /*!
  182. * Use constant/fixed-size audio buffers.
  183. */
  184. static const uint PLUGIN_OPTION_FIXED_BUFFERS = 0x001;
  185. /*!
  186. * Force mono plugin as stereo.
  187. */
  188. static const uint PLUGIN_OPTION_FORCE_STEREO = 0x002;
  189. /*!
  190. * Map MIDI programs to plugin programs.
  191. */
  192. static const uint PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004;
  193. /*!
  194. * Use chunks to save and restore data instead of parameter values.
  195. */
  196. static const uint PLUGIN_OPTION_USE_CHUNKS = 0x008;
  197. /*!
  198. * Send MIDI control change events.
  199. */
  200. static const uint PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010;
  201. /*!
  202. * Send MIDI channel pressure events.
  203. */
  204. static const uint PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020;
  205. /*!
  206. * Send MIDI note after-touch events.
  207. */
  208. static const uint PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040;
  209. /*!
  210. * Send MIDI pitch-bend events.
  211. */
  212. static const uint PLUGIN_OPTION_SEND_PITCHBEND = 0x080;
  213. /*!
  214. * Send MIDI all-sounds/notes-off events, single note-offs otherwise.
  215. */
  216. static const uint PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100;
  217. /*!
  218. * Send MIDI bank/program changes.
  219. * @note: This option conflicts with PLUGIN_OPTION_MAP_PROGRAM_CHANGES and cannot be used at the same time.
  220. */
  221. static const uint PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200;
  222. /*!
  223. * Skip sending MIDI note events.
  224. * This if off-by-default as a way to keep backwards compatibility.
  225. * We always want notes enabled by default, not the contrary.
  226. */
  227. static const uint PLUGIN_OPTION_SKIP_SENDING_NOTES = 0x400;
  228. /*!
  229. * Special flag to indicate that plugin options are not yet set.
  230. * This flag exists because 0x0 as an option value is a valid one, so we need something else to indicate "null-ness".
  231. */
  232. static const uint PLUGIN_OPTIONS_NULL = 0x10000;
  233. /** @} */
  234. /* ------------------------------------------------------------------------------------------------------------
  235. * Audio Port Hints */
  236. /*!
  237. * @defgroup AudioPortHints Audio Port Hints
  238. *
  239. * Various audio port hints.
  240. * @see CarlaPlugin::getAudioPortHints() and carla_get_audio_port_hints()
  241. * @{
  242. */
  243. /*!
  244. * Audio port should be used as sidechan.
  245. */
  246. static const uint AUDIO_PORT_IS_SIDECHAIN = 0x1;
  247. /** @} */
  248. /* ------------------------------------------------------------------------------------------------------------
  249. * Parameter Hints */
  250. /*!
  251. * @defgroup ParameterHints Parameter Hints
  252. *
  253. * Various parameter hints.
  254. * @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
  255. * @{
  256. */
  257. /*!
  258. * Parameter value is boolean.
  259. * It's always at either minimum or maximum value.
  260. */
  261. static const uint PARAMETER_IS_BOOLEAN = 0x001;
  262. /*!
  263. * Parameter value is integer.
  264. */
  265. static const uint PARAMETER_IS_INTEGER = 0x002;
  266. /*!
  267. * Parameter value is logarithmic.
  268. */
  269. static const uint PARAMETER_IS_LOGARITHMIC = 0x004;
  270. /*!
  271. * Parameter is enabled.
  272. * It can be viewed, changed and stored.
  273. */
  274. static const uint PARAMETER_IS_ENABLED = 0x010;
  275. /*!
  276. * Parameter is automatable (real-time safe).
  277. */
  278. static const uint PARAMETER_IS_AUTOMATABLE = 0x020;
  279. // for backwards compatibility
  280. static const uint PARAMETER_IS_AUTOMABLE = PARAMETER_IS_AUTOMATABLE;
  281. /*!
  282. * Parameter is read-only.
  283. * It cannot be changed.
  284. */
  285. static const uint PARAMETER_IS_READ_ONLY = 0x040;
  286. /*!
  287. * Parameter needs sample rate to work.
  288. * Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
  289. */
  290. static const uint PARAMETER_USES_SAMPLERATE = 0x100;
  291. /*!
  292. * Parameter uses scale points to define internal values in a meaningful way.
  293. */
  294. static const uint PARAMETER_USES_SCALEPOINTS = 0x200;
  295. /*!
  296. * Parameter uses custom text for displaying its value.
  297. * @see CarlaPlugin::getParameterText() and carla_get_parameter_text()
  298. */
  299. static const uint PARAMETER_USES_CUSTOM_TEXT = 0x400;
  300. /*!
  301. * Parameter can be turned into a CV control.
  302. */
  303. static const uint PARAMETER_CAN_BE_CV_CONTROLLED = 0x800;
  304. /*!
  305. * Parameter should not be saved as part of the project/session.
  306. * @note only valid for parameter inputs.
  307. */
  308. static const uint PARAMETER_IS_NOT_SAVED = 0x1000;
  309. /** @} */
  310. /* ------------------------------------------------------------------------------------------------------------
  311. * Mapped Parameter Flags */
  312. /*!
  313. * @defgroup MappedParameterFlags Mapped Parameter Flags
  314. *
  315. * Various flags for parameter mappings.
  316. * @see ParameterData::mappedFlags
  317. * @{
  318. */
  319. /*!
  320. * Parameter mapping uses delta value instead of full scale.
  321. * Only relevant for MIDI CC mappings.
  322. */
  323. static const uint PARAMETER_MAPPING_MIDI_DELTA = 0x001;
  324. /** @} */
  325. /* ------------------------------------------------------------------------------------------------------------
  326. * Patchbay Port Hints */
  327. /*!
  328. * @defgroup PatchbayPortHints Patchbay Port Hints
  329. *
  330. * Various patchbay port hints.
  331. * @{
  332. */
  333. /*!
  334. * Patchbay port is input.
  335. * When this hint is not set, port is assumed to be output.
  336. */
  337. static const uint PATCHBAY_PORT_IS_INPUT = 0x01;
  338. /*!
  339. * Patchbay port is of Audio type.
  340. */
  341. static const uint PATCHBAY_PORT_TYPE_AUDIO = 0x02;
  342. /*!
  343. * Patchbay port is of CV type (Control Voltage).
  344. */
  345. static const uint PATCHBAY_PORT_TYPE_CV = 0x04;
  346. /*!
  347. * Patchbay port is of MIDI type.
  348. */
  349. static const uint PATCHBAY_PORT_TYPE_MIDI = 0x08;
  350. /*!
  351. * Patchbay port is of OSC type.
  352. */
  353. static const uint PATCHBAY_PORT_TYPE_OSC = 0x10;
  354. /** @} */
  355. /* ------------------------------------------------------------------------------------------------------------
  356. * Patchbay Port Group Hints */
  357. /*!
  358. * @defgroup PatchbayPortGroupHints Patchbay Port Group Hints
  359. *
  360. * Various patchbay port group hints.
  361. * @{
  362. */
  363. /*!
  364. * Indicates that this group should be considered the "main" input.
  365. */
  366. static const uint PATCHBAY_PORT_GROUP_MAIN_INPUT = 0x01;
  367. /*!
  368. * Indicates that this group should be considered the "main" output.
  369. */
  370. static const uint PATCHBAY_PORT_GROUP_MAIN_OUTPUT = 0x02;
  371. /*!
  372. * A stereo port group, where the 1st port is left and the 2nd is right.
  373. */
  374. static const uint PATCHBAY_PORT_GROUP_STEREO = 0x04;
  375. /*!
  376. * A mid-side stereo group, where the 1st port is center and the 2nd is side.
  377. */
  378. static const uint PATCHBAY_PORT_GROUP_MID_SIDE = 0x08;
  379. /** @} */
  380. /* ------------------------------------------------------------------------------------------------------------
  381. * Custom Data Types */
  382. /*!
  383. * @defgroup CustomDataTypes Custom Data Types
  384. *
  385. * These types define how the value in the CustomData struct is stored.
  386. * @see CustomData::type
  387. * @{
  388. */
  389. /*!
  390. * Boolean string type URI.
  391. * Only "true" and "false" are valid values.
  392. */
  393. static const char* const CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean";
  394. /*!
  395. * Chunk type URI.
  396. */
  397. static const char* const CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk";
  398. /*!
  399. * Path type URI.
  400. */
  401. static const char* const CUSTOM_DATA_TYPE_PATH = "http://kxstudio.sf.net/ns/carla/path";
  402. /*!
  403. * Property type URI.
  404. */
  405. static const char* const CUSTOM_DATA_TYPE_PROPERTY = "http://kxstudio.sf.net/ns/carla/property";
  406. /*!
  407. * String type URI.
  408. */
  409. static const char* const CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string";
  410. /** @} */
  411. /* ------------------------------------------------------------------------------------------------------------
  412. * Custom Data Keys */
  413. /*!
  414. * @defgroup CustomDataKeys Custom Data Keys
  415. *
  416. * Pre-defined keys used internally in Carla.
  417. * @see CustomData::key
  418. * @{
  419. */
  420. /*!
  421. * UI position key.
  422. */
  423. static const char* const CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition";
  424. /*!
  425. * UI size key.
  426. */
  427. static const char* const CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize";
  428. /*!
  429. * UI visible key.
  430. */
  431. static const char* const CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible";
  432. /** @} */
  433. /* ------------------------------------------------------------------------------------------------------------
  434. * Binary Type */
  435. /*!
  436. * The binary type of a plugin.
  437. */
  438. typedef enum {
  439. /*!
  440. * Null binary type.
  441. */
  442. BINARY_NONE = 0,
  443. /*!
  444. * POSIX 32bit binary.
  445. */
  446. BINARY_POSIX32 = 1,
  447. /*!
  448. * POSIX 64bit binary.
  449. */
  450. BINARY_POSIX64 = 2,
  451. /*!
  452. * Windows 32bit binary.
  453. */
  454. BINARY_WIN32 = 3,
  455. /*!
  456. * Windows 64bit binary.
  457. */
  458. BINARY_WIN64 = 4,
  459. /*!
  460. * Other binary type.
  461. */
  462. BINARY_OTHER = 5
  463. } BinaryType;
  464. /* ------------------------------------------------------------------------------------------------------------
  465. * File Type */
  466. /*!
  467. * File type.
  468. */
  469. typedef enum {
  470. /*!
  471. * Null file type.
  472. */
  473. FILE_NONE = 0,
  474. /*!
  475. * Audio file.
  476. */
  477. FILE_AUDIO = 1,
  478. /*!
  479. * MIDI file.
  480. */
  481. FILE_MIDI = 2
  482. } FileType;
  483. /* ------------------------------------------------------------------------------------------------------------
  484. * Plugin Type */
  485. /*!
  486. * Plugin type.
  487. * Some files are handled as if they were plugins.
  488. */
  489. typedef enum {
  490. /*!
  491. * Null plugin type.
  492. */
  493. PLUGIN_NONE = 0,
  494. /*!
  495. * Internal plugin.
  496. */
  497. PLUGIN_INTERNAL = 1,
  498. /*!
  499. * LADSPA plugin.
  500. */
  501. PLUGIN_LADSPA = 2,
  502. /*!
  503. * DSSI plugin.
  504. */
  505. PLUGIN_DSSI = 3,
  506. /*!
  507. * LV2 plugin.
  508. */
  509. PLUGIN_LV2 = 4,
  510. /*!
  511. * VST2 plugin.
  512. */
  513. PLUGIN_VST2 = 5,
  514. /*!
  515. * VST3 plugin.
  516. * @note Windows and MacOS only
  517. */
  518. PLUGIN_VST3 = 6,
  519. /*!
  520. * AU plugin.
  521. * @note MacOS only
  522. */
  523. PLUGIN_AU = 7,
  524. /*!
  525. * DLS file.
  526. */
  527. PLUGIN_DLS = 8,
  528. /*!
  529. * GIG file.
  530. */
  531. PLUGIN_GIG = 9,
  532. /*!
  533. * SF2/3 file (SoundFont).
  534. */
  535. PLUGIN_SF2 = 10,
  536. /*!
  537. * SFZ file.
  538. */
  539. PLUGIN_SFZ = 11,
  540. /*!
  541. * JACK application.
  542. */
  543. PLUGIN_JACK = 12,
  544. /*!
  545. * JSFX plugin.
  546. */
  547. PLUGIN_JSFX = 13
  548. } PluginType;
  549. /* ------------------------------------------------------------------------------------------------------------
  550. * Plugin Category */
  551. /*!
  552. * Plugin category, which describes the functionality of a plugin.
  553. */
  554. typedef enum {
  555. /*!
  556. * Null plugin category.
  557. */
  558. PLUGIN_CATEGORY_NONE = 0,
  559. /*!
  560. * A synthesizer or generator.
  561. */
  562. PLUGIN_CATEGORY_SYNTH = 1,
  563. /*!
  564. * A delay or reverb.
  565. */
  566. PLUGIN_CATEGORY_DELAY = 2,
  567. /*!
  568. * An equalizer.
  569. */
  570. PLUGIN_CATEGORY_EQ = 3,
  571. /*!
  572. * A filter.
  573. */
  574. PLUGIN_CATEGORY_FILTER = 4,
  575. /*!
  576. * A distortion plugin.
  577. */
  578. PLUGIN_CATEGORY_DISTORTION = 5,
  579. /*!
  580. * A 'dynamic' plugin (amplifier, compressor, gate, etc).
  581. */
  582. PLUGIN_CATEGORY_DYNAMICS = 6,
  583. /*!
  584. * A 'modulator' plugin (chorus, flanger, phaser, etc).
  585. */
  586. PLUGIN_CATEGORY_MODULATOR = 7,
  587. /*!
  588. * An 'utility' plugin (analyzer, converter, mixer, etc).
  589. */
  590. PLUGIN_CATEGORY_UTILITY = 8,
  591. /*!
  592. * Miscellaneous plugin (used to check if the plugin has a category).
  593. */
  594. PLUGIN_CATEGORY_OTHER = 9
  595. } PluginCategory;
  596. /* ------------------------------------------------------------------------------------------------------------
  597. * Parameter Type */
  598. /*!
  599. * Plugin parameter type.
  600. */
  601. typedef enum {
  602. /*!
  603. * Null parameter type.
  604. */
  605. PARAMETER_UNKNOWN = 0,
  606. /*!
  607. * Input parameter.
  608. */
  609. PARAMETER_INPUT = 1,
  610. /*!
  611. * Output parameter.
  612. */
  613. PARAMETER_OUTPUT = 2
  614. } ParameterType;
  615. /* ------------------------------------------------------------------------------------------------------------
  616. * Internal Parameter Index */
  617. /*!
  618. * Special parameters used internally in Carla.
  619. * Plugins do not know about their existence.
  620. */
  621. typedef enum {
  622. /*!
  623. * Null parameter.
  624. */
  625. PARAMETER_NULL = -1,
  626. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  627. /*!
  628. * Active parameter, boolean type.
  629. * Default is 'false'.
  630. */
  631. PARAMETER_ACTIVE = -2,
  632. /*!
  633. * Dry/Wet parameter.
  634. * Range 0.0...1.0; default is 1.0.
  635. */
  636. PARAMETER_DRYWET = -3,
  637. /*!
  638. * Volume parameter.
  639. * Range 0.0...1.27; default is 1.0.
  640. */
  641. PARAMETER_VOLUME = -4,
  642. /*!
  643. * Stereo Balance-Left parameter.
  644. * Range -1.0...1.0; default is -1.0.
  645. */
  646. PARAMETER_BALANCE_LEFT = -5,
  647. /*!
  648. * Stereo Balance-Right parameter.
  649. * Range -1.0...1.0; default is 1.0.
  650. */
  651. PARAMETER_BALANCE_RIGHT = -6,
  652. /*!
  653. * Mono Panning parameter.
  654. * Range -1.0...1.0; default is 0.0.
  655. */
  656. PARAMETER_PANNING = -7,
  657. /*!
  658. * MIDI Control channel, integer type.
  659. * Range -1...15 (-1 = off).
  660. */
  661. PARAMETER_CTRL_CHANNEL = -8,
  662. #endif
  663. /*!
  664. * Max value, defined only for convenience.
  665. */
  666. PARAMETER_MAX = -9
  667. } InternalParameterIndex;
  668. /* ------------------------------------------------------------------------------------------------------------
  669. * Special Mapped Control Index */
  670. /*!
  671. * Specially designated mapped control indexes.
  672. * Values between 0 and 119 (0x77) are reserved for MIDI CC, which uses direct values.
  673. * @see ParameterData::mappedControlIndex
  674. */
  675. typedef enum {
  676. /*!
  677. * Unused control index, meaning no mapping is enabled.
  678. */
  679. CONTROL_INDEX_NONE = -1,
  680. /*!
  681. * CV control index, meaning the parameter is exposed as CV port.
  682. */
  683. CONTROL_INDEX_CV = 130,
  684. /*!
  685. * Special value to indicate MIDI pitchbend.
  686. */
  687. CONTROL_INDEX_MIDI_PITCHBEND = 131,
  688. /*!
  689. * Special value to indicate MIDI learn.
  690. */
  691. CONTROL_INDEX_MIDI_LEARN = 132,
  692. /*!
  693. * Highest index allowed for mappings.
  694. */
  695. CONTROL_INDEX_MAX_ALLOWED = CONTROL_INDEX_MIDI_LEARN
  696. } SpecialMappedControlIndex;
  697. /* ------------------------------------------------------------------------------------------------------------
  698. * Engine Callback Opcode */
  699. /*!
  700. * Engine callback opcodes.
  701. * Front-ends must never block indefinitely during a callback.
  702. * @see EngineCallbackFunc, CarlaEngine::setCallback() and carla_set_engine_callback()
  703. */
  704. typedef enum {
  705. /*!
  706. * Debug.
  707. * This opcode is undefined and used only for testing purposes.
  708. */
  709. ENGINE_CALLBACK_DEBUG = 0,
  710. /*!
  711. * A plugin has been added.
  712. * @a pluginId Plugin Id
  713. * @a value1 Plugin type
  714. * @a valueStr Plugin name
  715. */
  716. ENGINE_CALLBACK_PLUGIN_ADDED = 1,
  717. /*!
  718. * A plugin has been removed.
  719. * @a pluginId Plugin Id
  720. */
  721. ENGINE_CALLBACK_PLUGIN_REMOVED = 2,
  722. /*!
  723. * A plugin has been renamed.
  724. * @a pluginId Plugin Id
  725. * @a valueStr New plugin name
  726. */
  727. ENGINE_CALLBACK_PLUGIN_RENAMED = 3,
  728. /*!
  729. * A plugin has become unavailable.
  730. * @a pluginId Plugin Id
  731. * @a valueStr Related error string
  732. */
  733. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4,
  734. /*!
  735. * A parameter value has changed.
  736. * @a pluginId Plugin Id
  737. * @a value1 Parameter index
  738. * @a valuef New parameter value
  739. */
  740. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5,
  741. /*!
  742. * A parameter default has changed.
  743. * @a pluginId Plugin Id
  744. * @a value1 Parameter index
  745. * @a valuef New default value
  746. */
  747. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6,
  748. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  749. /*!
  750. * A parameter's mapped control index has changed.
  751. * @a pluginId Plugin Id
  752. * @a value1 Parameter index
  753. * @a value2 New control index
  754. */
  755. ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED = 7,
  756. /*!
  757. * A parameter's MIDI channel has changed.
  758. * @a pluginId Plugin Id
  759. * @a value1 Parameter index
  760. * @a value2 New MIDI channel
  761. */
  762. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8,
  763. /*!
  764. * A plugin option has changed.
  765. * @a pluginId Plugin Id
  766. * @a value1 Option
  767. * @a value2 New on/off state (1 for on, 0 for off)
  768. * @see PluginOptions
  769. */
  770. ENGINE_CALLBACK_OPTION_CHANGED = 9,
  771. #endif
  772. /*!
  773. * The current program of a plugin has changed.
  774. * @a pluginId Plugin Id
  775. * @a value1 New program index
  776. */
  777. ENGINE_CALLBACK_PROGRAM_CHANGED = 10,
  778. /*!
  779. * The current MIDI program of a plugin has changed.
  780. * @a pluginId Plugin Id
  781. * @a value1 New MIDI program index
  782. */
  783. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11,
  784. /*!
  785. * A plugin's custom UI state has changed.
  786. * @a pluginId Plugin Id
  787. * @a value1 New state, as follows:
  788. * 0: UI is now hidden
  789. * 1: UI is now visible
  790. * -1: UI has crashed and should not be shown again
  791. */
  792. ENGINE_CALLBACK_UI_STATE_CHANGED = 12,
  793. /*!
  794. * A note has been pressed.
  795. * @a pluginId Plugin Id
  796. * @a value1 Channel
  797. * @a value2 Note
  798. * @a value3 Velocity
  799. */
  800. ENGINE_CALLBACK_NOTE_ON = 13,
  801. /*!
  802. * A note has been released.
  803. * @a pluginId Plugin Id
  804. * @a value1 Channel
  805. * @a value2 Note
  806. */
  807. ENGINE_CALLBACK_NOTE_OFF = 14,
  808. /*!
  809. * A plugin needs update.
  810. * @a pluginId Plugin Id
  811. */
  812. ENGINE_CALLBACK_UPDATE = 15,
  813. /*!
  814. * A plugin's data/information has changed.
  815. * @a pluginId Plugin Id
  816. */
  817. ENGINE_CALLBACK_RELOAD_INFO = 16,
  818. /*!
  819. * A plugin's parameters have changed.
  820. * @a pluginId Plugin Id
  821. */
  822. ENGINE_CALLBACK_RELOAD_PARAMETERS = 17,
  823. /*!
  824. * A plugin's programs have changed.
  825. * @a pluginId Plugin Id
  826. */
  827. ENGINE_CALLBACK_RELOAD_PROGRAMS = 18,
  828. /*!
  829. * A plugin state has changed.
  830. * @a pluginId Plugin Id
  831. */
  832. ENGINE_CALLBACK_RELOAD_ALL = 19,
  833. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  834. /*!
  835. * A patchbay client has been added.
  836. * @a pluginId Client Id
  837. * @a value1 Client icon
  838. * @a value2 Plugin Id (-1 if not a plugin)
  839. * @a valueStr Client name
  840. * @see PatchbayIcon
  841. */
  842. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20,
  843. /*!
  844. * A patchbay client has been removed.
  845. * @a pluginId Client Id
  846. */
  847. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21,
  848. /*!
  849. * A patchbay client has been renamed.
  850. * @a pluginId Client Id
  851. * @a valueStr New client name
  852. */
  853. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22,
  854. /*!
  855. * A patchbay client data has changed.
  856. * @a pluginId Client Id
  857. * @a value1 New icon
  858. * @a value2 New plugin Id (-1 if not a plugin)
  859. * @see PatchbayIcon
  860. */
  861. ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23,
  862. /*!
  863. * A patchbay port has been added.
  864. * @a pluginId Client Id
  865. * @a value1 Port Id
  866. * @a value2 Port hints
  867. * @a value3 Port group Id (0 for none)
  868. * @a valueStr Port name
  869. * @see PatchbayPortHints
  870. */
  871. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24,
  872. /*!
  873. * A patchbay port has been removed.
  874. * @a pluginId Client Id
  875. * @a value1 Port Id
  876. */
  877. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25,
  878. /*!
  879. * A patchbay port has changed (like the name or group Id).
  880. * @a pluginId Client Id
  881. * @a value1 Port Id
  882. * @a value2 Port hints
  883. * @a value3 Port group Id (0 for none)
  884. * @a valueStr Port name
  885. */
  886. ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED = 26,
  887. /*!
  888. * A patchbay connection has been added.
  889. * @a pluginId Connection Id
  890. * @a valueStr Out group and port plus in group and port, in "og:op:ig:ip" syntax.
  891. */
  892. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27,
  893. /*!
  894. * A patchbay connection has been removed.
  895. * @a pluginId Connection Id
  896. */
  897. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28,
  898. #endif
  899. /*!
  900. * Engine started.
  901. * @a pluginId How many plugins are known to be running
  902. * @a value1 Process mode
  903. * @a value2 Transport mode
  904. * @a value3 Buffer size
  905. * @a valuef Sample rate
  906. * @a valuestr Engine driver
  907. * @see EngineProcessMode
  908. * @see EngineTransportMode
  909. */
  910. ENGINE_CALLBACK_ENGINE_STARTED = 29,
  911. /*!
  912. * Engine stopped.
  913. */
  914. ENGINE_CALLBACK_ENGINE_STOPPED = 30,
  915. /*!
  916. * Engine process mode has changed.
  917. * @a value1 New process mode
  918. * @see EngineProcessMode
  919. */
  920. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31,
  921. /*!
  922. * Engine transport mode has changed.
  923. * @a value1 New transport mode
  924. * @a valueStr New transport features enabled
  925. * @see EngineTransportMode
  926. */
  927. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32,
  928. /*!
  929. * Engine buffer-size changed.
  930. * @a value1 New buffer size
  931. */
  932. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33,
  933. /*!
  934. * Engine sample-rate changed.
  935. * @a valuef New sample rate
  936. */
  937. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34,
  938. /*!
  939. * A cancelable action has been started or stopped.
  940. * @a pluginId Plugin Id the action relates to, -1 for none
  941. * @a value1 1 for action started, 0 for stopped
  942. * @a valueStr Action name
  943. */
  944. ENGINE_CALLBACK_CANCELABLE_ACTION = 35,
  945. /*!
  946. * Project has finished loading.
  947. */
  948. ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36,
  949. /*!
  950. * NSM callback, to be handled by a frontend.
  951. * Frontend must call carla_nsm_ready() with opcode as parameter as a response
  952. * @a value1 NSM opcode
  953. * @a value2 Integer value
  954. * @a valueStr String value
  955. * @see NsmCallbackOpcode
  956. */
  957. ENGINE_CALLBACK_NSM = 37,
  958. /*!
  959. * Idle frontend.
  960. * This is used by the engine during long operations that might block the frontend,
  961. * giving it the possibility to idle while the operation is still in place.
  962. */
  963. ENGINE_CALLBACK_IDLE = 38,
  964. /*!
  965. * Show a message as information.
  966. * @a valueStr The message
  967. */
  968. ENGINE_CALLBACK_INFO = 39,
  969. /*!
  970. * Show a message as an error.
  971. * @a valueStr The message
  972. */
  973. ENGINE_CALLBACK_ERROR = 40,
  974. /*!
  975. * The engine has crashed or malfunctioned and will no longer work.
  976. */
  977. ENGINE_CALLBACK_QUIT = 41,
  978. /*!
  979. * A plugin requested for its inline display to be redrawn.
  980. * @a pluginId Plugin Id to redraw
  981. */
  982. ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW = 42,
  983. /*!
  984. * A patchbay port group has been added.
  985. * @a pluginId Client Id
  986. * @a value1 Group Id (unique value within this client)
  987. * @a value2 Group hints
  988. * @a valueStr Group name
  989. * @see PatchbayPortGroupHints
  990. */
  991. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED = 43,
  992. /*!
  993. * A patchbay port group has been removed.
  994. * @a pluginId Client Id
  995. * @a value1 Group Id
  996. */
  997. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED = 44,
  998. /*!
  999. * A patchbay port group has changed.
  1000. * @a pluginId Client Id
  1001. * @a value1 Group Id
  1002. * @a value2 Group hints
  1003. * @a valueStr Group name
  1004. * @see PatchbayPortGroupHints
  1005. */
  1006. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED = 45,
  1007. /*!
  1008. * A parameter's mapped range has changed.
  1009. * @a pluginId Plugin Id
  1010. * @a value1 Parameter index
  1011. * @a valueStr New mapped range as "%f:%f" syntax
  1012. */
  1013. ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED = 46,
  1014. /*!
  1015. * A patchbay client position has changed.
  1016. * @a pluginId Client Id
  1017. * @a value1 X position 1
  1018. * @a value2 Y position 1
  1019. * @a value3 X position 2
  1020. * @a valuef Y position 2
  1021. */
  1022. ENGINE_CALLBACK_PATCHBAY_CLIENT_POSITION_CHANGED = 47,
  1023. /*!
  1024. * A plugin embed UI has been resized.
  1025. * @a pluginId Plugin Id to resize
  1026. * @a value1 New width
  1027. * @a value2 New height
  1028. */
  1029. ENGINE_CALLBACK_EMBED_UI_RESIZED = 48
  1030. } EngineCallbackOpcode;
  1031. /* ------------------------------------------------------------------------------------------------------------
  1032. * NSM Callback Opcode */
  1033. /*!
  1034. * NSM callback opcodes.
  1035. * @see ENGINE_CALLBACK_NSM
  1036. */
  1037. typedef enum {
  1038. /*!
  1039. * NSM is available and initialized.
  1040. */
  1041. NSM_CALLBACK_INIT = 0,
  1042. /*!
  1043. * Error from NSM side.
  1044. * @a valueInt Error code
  1045. * @a valueStr Error string
  1046. */
  1047. NSM_CALLBACK_ERROR = 1,
  1048. /*!
  1049. * Announce message.
  1050. * @a valueInt SM Flags (WIP, to be defined)
  1051. * @a valueStr SM Name
  1052. */
  1053. NSM_CALLBACK_ANNOUNCE = 2,
  1054. /*!
  1055. * Open message.
  1056. * @a valueStr Project filename
  1057. */
  1058. NSM_CALLBACK_OPEN = 3,
  1059. /*!
  1060. * Save message.
  1061. */
  1062. NSM_CALLBACK_SAVE = 4,
  1063. /*!
  1064. * Session-is-loaded message.
  1065. */
  1066. NSM_CALLBACK_SESSION_IS_LOADED = 5,
  1067. /*!
  1068. * Show-optional-gui message.
  1069. */
  1070. NSM_CALLBACK_SHOW_OPTIONAL_GUI = 6,
  1071. /*!
  1072. * Hide-optional-gui message.
  1073. */
  1074. NSM_CALLBACK_HIDE_OPTIONAL_GUI = 7,
  1075. /*!
  1076. * Set client name id message.
  1077. */
  1078. NSM_CALLBACK_SET_CLIENT_NAME_ID = 8
  1079. } NsmCallbackOpcode;
  1080. /* ------------------------------------------------------------------------------------------------------------
  1081. * Engine Option */
  1082. /*!
  1083. * Engine options.
  1084. * @see CarlaEngine::getOptions(), CarlaEngine::setOption() and carla_set_engine_option()
  1085. */
  1086. typedef enum {
  1087. /*!
  1088. * Debug.
  1089. * This option is undefined and used only for testing purposes.
  1090. */
  1091. ENGINE_OPTION_DEBUG = 0,
  1092. /*!
  1093. * Set the engine processing mode.
  1094. * Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_PATCHBAY for all other OSes.
  1095. * @see EngineProcessMode
  1096. */
  1097. ENGINE_OPTION_PROCESS_MODE = 1,
  1098. /*!
  1099. * Set the engine transport mode.
  1100. * Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  1101. * @see EngineTransportMode
  1102. */
  1103. ENGINE_OPTION_TRANSPORT_MODE = 2,
  1104. /*!
  1105. * Force mono plugins as stereo, by running 2 instances at the same time.
  1106. * Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  1107. * @note Not supported by all plugins
  1108. * @see PLUGIN_OPTION_FORCE_STEREO
  1109. */
  1110. ENGINE_OPTION_FORCE_STEREO = 3,
  1111. /*!
  1112. * Use plugin bridges whenever possible.
  1113. * Default is no, EXPERIMENTAL.
  1114. */
  1115. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4,
  1116. /*!
  1117. * Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  1118. * Default is yes.
  1119. */
  1120. ENGINE_OPTION_PREFER_UI_BRIDGES = 5,
  1121. /*!
  1122. * Make custom plugin UIs always-on-top.
  1123. * Default is yes.
  1124. */
  1125. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6,
  1126. /*!
  1127. * Maximum number of parameters allowed.
  1128. * Default is MAX_DEFAULT_PARAMETERS.
  1129. */
  1130. ENGINE_OPTION_MAX_PARAMETERS = 7,
  1131. /*!
  1132. * Reset Xrun counter after project load.
  1133. */
  1134. ENGINE_OPTION_RESET_XRUNS = 8,
  1135. /*!
  1136. * Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  1137. * Default is 4000 (4 seconds).
  1138. */
  1139. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 9,
  1140. /*!
  1141. * Audio buffer size.
  1142. * Default is 512.
  1143. */
  1144. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10,
  1145. /*!
  1146. * Audio sample rate.
  1147. * Default is 44100.
  1148. */
  1149. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11,
  1150. /*!
  1151. * Wherever to use 3 audio periods instead of the default 2.
  1152. * Default is false.
  1153. */
  1154. ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 12,
  1155. /*!
  1156. * Audio driver.
  1157. * Default depends on platform.
  1158. */
  1159. ENGINE_OPTION_AUDIO_DRIVER = 13,
  1160. /*!
  1161. * Audio device (within a driver).
  1162. * Default unset.
  1163. */
  1164. ENGINE_OPTION_AUDIO_DEVICE = 14,
  1165. #ifndef BUILD_BRIDGE
  1166. /*!
  1167. * Wherever to enable OSC support in the engine.
  1168. */
  1169. ENGINE_OPTION_OSC_ENABLED = 15,
  1170. /*!
  1171. * The network TCP port to use for OSC.
  1172. * A value of 0 means use a random port.
  1173. * A value of < 0 means to not enable the TCP port for OSC.
  1174. * @note Valid ports begin at 1024 and end at 32767 (inclusive)
  1175. */
  1176. ENGINE_OPTION_OSC_PORT_TCP = 16,
  1177. /*!
  1178. * The network UDP port to use for OSC.
  1179. * A value of 0 means use a random port.
  1180. * A value of < 0 means to not enable the UDP port for OSC.
  1181. * @note Disabling this option prevents DSSI UIs from working!
  1182. * @note Valid ports begin at 1024 and end at 32767 (inclusive)
  1183. */
  1184. ENGINE_OPTION_OSC_PORT_UDP = 17,
  1185. #endif
  1186. /*!
  1187. * Set path used for a specific file type.
  1188. * Uses value as the file format, valueStr as actual path.
  1189. */
  1190. ENGINE_OPTION_FILE_PATH = 18,
  1191. /*!
  1192. * Set path used for a specific plugin type.
  1193. * Uses value as the plugin format, valueStr as actual path.
  1194. * @see PluginType
  1195. */
  1196. ENGINE_OPTION_PLUGIN_PATH = 19,
  1197. /*!
  1198. * Set path to the binary files.
  1199. * Default unset.
  1200. * @note Must be set for plugin and UI bridges to work
  1201. */
  1202. ENGINE_OPTION_PATH_BINARIES = 20,
  1203. /*!
  1204. * Set path to the resource files.
  1205. * Default unset.
  1206. * @note Must be set for some internal plugins to work
  1207. */
  1208. ENGINE_OPTION_PATH_RESOURCES = 21,
  1209. /*!
  1210. * Prevent bad plugin and UI behaviour.
  1211. * @note: Linux only
  1212. */
  1213. ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 22,
  1214. /*!
  1215. * Set background color used in the frontend, so backend can do the same for plugin UIs.
  1216. */
  1217. ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR = 23,
  1218. /*!
  1219. * Set foreground color used in the frontend, so backend can do the same for plugin UIs.
  1220. */
  1221. ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR = 24,
  1222. /*!
  1223. * Set UI scaling used in the frontend, so backend can do the same for plugin UIs.
  1224. */
  1225. ENGINE_OPTION_FRONTEND_UI_SCALE = 25,
  1226. /*!
  1227. * Set frontend winId, used to define as parent window for plugin UIs.
  1228. */
  1229. ENGINE_OPTION_FRONTEND_WIN_ID = 26,
  1230. #if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
  1231. /*!
  1232. * Set path to wine executable.
  1233. */
  1234. ENGINE_OPTION_WINE_EXECUTABLE = 27,
  1235. /*!
  1236. * Enable automatic wineprefix detection.
  1237. */
  1238. ENGINE_OPTION_WINE_AUTO_PREFIX = 28,
  1239. /*!
  1240. * Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
  1241. */
  1242. ENGINE_OPTION_WINE_FALLBACK_PREFIX = 29,
  1243. /*!
  1244. * Enable realtime priority for Wine application and server threads.
  1245. */
  1246. ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 30,
  1247. /*!
  1248. * Base realtime priority for Wine threads.
  1249. */
  1250. ENGINE_OPTION_WINE_BASE_RT_PRIO = 31,
  1251. /*!
  1252. * Wine server realtime priority.
  1253. */
  1254. ENGINE_OPTION_WINE_SERVER_RT_PRIO = 32,
  1255. #endif
  1256. #ifndef BUILD_BRIDGE
  1257. /*!
  1258. * Capture console output into debug callbacks.
  1259. */
  1260. ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33,
  1261. #endif
  1262. /*!
  1263. * A prefix to give to all plugin clients created by Carla.
  1264. * Mostly useful for JACK multi-client mode.
  1265. * @note MUST include at least one "." (dot).
  1266. */
  1267. ENGINE_OPTION_CLIENT_NAME_PREFIX = 34,
  1268. /*!
  1269. * Treat loaded plugins as standalone (that is, there is no host UI to manage them)
  1270. */
  1271. ENGINE_OPTION_PLUGINS_ARE_STANDALONE = 35
  1272. } EngineOption;
  1273. /* ------------------------------------------------------------------------------------------------------------
  1274. * Engine Process Mode */
  1275. /*!
  1276. * Engine process mode.
  1277. * @see ENGINE_OPTION_PROCESS_MODE
  1278. */
  1279. typedef enum {
  1280. /*!
  1281. * Single client mode.
  1282. * Inputs and outputs are added dynamically as needed by plugins.
  1283. */
  1284. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0,
  1285. /*!
  1286. * Multiple client mode.
  1287. * It has 1 master client + 1 client per plugin.
  1288. */
  1289. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1,
  1290. /*!
  1291. * Single client, 'rack' mode.
  1292. * Processes plugins in order of Id, with forced stereo always on.
  1293. */
  1294. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2,
  1295. /*!
  1296. * Single client, 'patchbay' mode.
  1297. */
  1298. ENGINE_PROCESS_MODE_PATCHBAY = 3,
  1299. /*!
  1300. * Special mode, used in plugin-bridges only.
  1301. */
  1302. ENGINE_PROCESS_MODE_BRIDGE = 4
  1303. } EngineProcessMode;
  1304. /* ------------------------------------------------------------------------------------------------------------
  1305. * Engine Transport Mode */
  1306. /*!
  1307. * Engine transport mode.
  1308. * @see ENGINE_OPTION_TRANSPORT_MODE
  1309. */
  1310. typedef enum {
  1311. /*!
  1312. * No transport.
  1313. */
  1314. ENGINE_TRANSPORT_MODE_DISABLED = 0,
  1315. /*!
  1316. * Internal transport mode.
  1317. */
  1318. ENGINE_TRANSPORT_MODE_INTERNAL = 1,
  1319. /*!
  1320. * Transport from JACK.
  1321. * Only available if driver name is "JACK".
  1322. */
  1323. ENGINE_TRANSPORT_MODE_JACK = 2,
  1324. /*!
  1325. * Transport from host, used when Carla is a plugin.
  1326. */
  1327. ENGINE_TRANSPORT_MODE_PLUGIN = 3,
  1328. /*!
  1329. * Special mode, used in plugin-bridges only.
  1330. */
  1331. ENGINE_TRANSPORT_MODE_BRIDGE = 4
  1332. } EngineTransportMode;
  1333. /* ------------------------------------------------------------------------------------------------------------
  1334. * File Callback Opcode */
  1335. /*!
  1336. * File callback opcodes.
  1337. * Front-ends must always block-wait for user input.
  1338. * @see FileCallbackFunc, CarlaEngine::setFileCallback() and carla_set_file_callback()
  1339. */
  1340. typedef enum {
  1341. /*!
  1342. * Debug.
  1343. * This opcode is undefined and used only for testing purposes.
  1344. */
  1345. FILE_CALLBACK_DEBUG = 0,
  1346. /*!
  1347. * Open file or folder.
  1348. */
  1349. FILE_CALLBACK_OPEN = 1,
  1350. /*!
  1351. * Save file or folder.
  1352. */
  1353. FILE_CALLBACK_SAVE = 2
  1354. } FileCallbackOpcode;
  1355. /* ------------------------------------------------------------------------------------------------------------
  1356. * Patchbay Icon */
  1357. /*!
  1358. * The icon of a patchbay client/group.
  1359. */
  1360. enum PatchbayIcon {
  1361. /*!
  1362. * Generic application icon.
  1363. * Used for all non-plugin clients that don't have a specific icon.
  1364. */
  1365. PATCHBAY_ICON_APPLICATION = 0,
  1366. /*!
  1367. * Plugin icon.
  1368. * Used for all plugin clients that don't have a specific icon.
  1369. */
  1370. PATCHBAY_ICON_PLUGIN = 1,
  1371. /*!
  1372. * Hardware icon.
  1373. * Used for hardware (audio or MIDI) clients.
  1374. */
  1375. PATCHBAY_ICON_HARDWARE = 2,
  1376. /*!
  1377. * Carla icon.
  1378. * Used for the main app.
  1379. */
  1380. PATCHBAY_ICON_CARLA = 3,
  1381. /*!
  1382. * DISTRHO icon.
  1383. * Used for DISTRHO based plugins.
  1384. */
  1385. PATCHBAY_ICON_DISTRHO = 4,
  1386. /*!
  1387. * File icon.
  1388. * Used for file type plugins (like SF2 snd SFZ).
  1389. */
  1390. PATCHBAY_ICON_FILE = 5
  1391. };
  1392. /* ------------------------------------------------------------------------------------------------------------
  1393. * Carla Backend API (C stuff) */
  1394. /*!
  1395. * Engine callback function.
  1396. * Front-ends must never block indefinitely during a callback.
  1397. * @see EngineCallbackOpcode, CarlaEngine::setCallback() and carla_set_engine_callback()
  1398. */
  1399. typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackOpcode action, uint pluginId,
  1400. int value1, int value2, int value3,
  1401. float valuef, const char* valueStr);
  1402. /*!
  1403. * File callback function.
  1404. * @see FileCallbackOpcode
  1405. */
  1406. typedef const char* (*FileCallbackFunc)(void* ptr, FileCallbackOpcode action, bool isDir, const char* title, const char* filter);
  1407. /*!
  1408. * Parameter data.
  1409. */
  1410. typedef struct {
  1411. /*!
  1412. * This parameter type.
  1413. */
  1414. ParameterType type;
  1415. /*!
  1416. * This parameter hints.
  1417. * @see ParameterHints
  1418. */
  1419. uint hints;
  1420. /*!
  1421. * Index as seen by Carla.
  1422. */
  1423. int32_t index;
  1424. /*!
  1425. * Real index as seen by plugins.
  1426. */
  1427. int32_t rindex;
  1428. /*!
  1429. * Currently mapped MIDI channel.
  1430. * Counts from 0 to 15.
  1431. */
  1432. uint8_t midiChannel;
  1433. /*!
  1434. * Currently mapped index.
  1435. * @see SpecialMappedControlIndex
  1436. */
  1437. int16_t mappedControlIndex;
  1438. /*!
  1439. * Minimum value that this parameter maps to.
  1440. */
  1441. float mappedMinimum;
  1442. /*!
  1443. * Maximum value that this parameter maps to.
  1444. */
  1445. float mappedMaximum;
  1446. /*!
  1447. * Flags related to the current mapping of this parameter.
  1448. * @see MappedParameterFlags
  1449. */
  1450. uint mappedFlags;
  1451. } ParameterData;
  1452. /*!
  1453. * Parameter ranges.
  1454. */
  1455. typedef struct _ParameterRanges {
  1456. /*!
  1457. * Default value.
  1458. */
  1459. float def;
  1460. /*!
  1461. * Minimum value.
  1462. */
  1463. float min;
  1464. /*!
  1465. * Maximum value.
  1466. */
  1467. float max;
  1468. /*!
  1469. * Regular, single step value.
  1470. */
  1471. float step;
  1472. /*!
  1473. * Small step value.
  1474. */
  1475. float stepSmall;
  1476. /*!
  1477. * Large step value.
  1478. */
  1479. float stepLarge;
  1480. #ifdef __cplusplus
  1481. /*!
  1482. * Fix the default value within range.
  1483. */
  1484. void fixDefault() noexcept
  1485. {
  1486. fixValue(def);
  1487. }
  1488. /*!
  1489. * Fix a value within range.
  1490. */
  1491. void fixValue(float& value) const noexcept
  1492. {
  1493. if (value < min)
  1494. value = min;
  1495. else if (value > max)
  1496. value = max;
  1497. }
  1498. /*!
  1499. * Get a fixed value within range.
  1500. */
  1501. const float& getFixedValue(const float& value) const noexcept
  1502. {
  1503. if (value <= min)
  1504. return min;
  1505. if (value >= max)
  1506. return max;
  1507. return value;
  1508. }
  1509. /*!
  1510. * Get a value normalized to 0.0<->1.0.
  1511. */
  1512. float getNormalizedValue(const float& value) const noexcept
  1513. {
  1514. const float normValue((value - min) / (max - min));
  1515. if (normValue <= 0.0f)
  1516. return 0.0f;
  1517. if (normValue >= 1.0f)
  1518. return 1.0f;
  1519. return normValue;
  1520. }
  1521. /*!
  1522. * Get a value normalized to 0.0<->1.0, fixed within range.
  1523. */
  1524. float getFixedAndNormalizedValue(const float& value) const noexcept
  1525. {
  1526. if (value <= min)
  1527. return 0.0f;
  1528. if (value >= max)
  1529. return 1.0f;
  1530. const float normValue((value - min) / (max - min));
  1531. if (normValue <= 0.0f)
  1532. return 0.0f;
  1533. if (normValue >= 1.0f)
  1534. return 1.0f;
  1535. return normValue;
  1536. }
  1537. /*!
  1538. * Get a proper value previously normalized to 0.0<->1.0.
  1539. */
  1540. float getUnnormalizedValue(const float& value) const noexcept
  1541. {
  1542. if (value <= 0.0f)
  1543. return min;
  1544. if (value >= 1.0f)
  1545. return max;
  1546. return value * (max - min) + min;
  1547. }
  1548. /*!
  1549. * Get a logarithmic value previously normalized to 0.0<->1.0.
  1550. */
  1551. float getUnnormalizedLogValue(const float& value) const noexcept
  1552. {
  1553. if (value <= 0.0f)
  1554. return min;
  1555. if (value >= 1.0f)
  1556. return max;
  1557. float rmin = min;
  1558. if (std::abs(min) < std::numeric_limits<float>::epsilon())
  1559. rmin = 0.00001f;
  1560. return rmin * std::pow(max/rmin, value);
  1561. }
  1562. #endif /* __cplusplus */
  1563. } ParameterRanges;
  1564. /*!
  1565. * MIDI Program data.
  1566. */
  1567. typedef struct {
  1568. /*!
  1569. * MIDI bank.
  1570. */
  1571. uint32_t bank;
  1572. /*!
  1573. * MIDI program.
  1574. */
  1575. uint32_t program;
  1576. /*!
  1577. * MIDI program name.
  1578. */
  1579. const char* name;
  1580. } MidiProgramData;
  1581. /*!
  1582. * Custom data, used for saving key:value 'dictionaries'.
  1583. */
  1584. typedef struct _CustomData {
  1585. /*!
  1586. * Value type, in URI form.
  1587. * @see CustomDataTypes
  1588. */
  1589. const char* type;
  1590. /*!
  1591. * Key.
  1592. * @see CustomDataKeys
  1593. */
  1594. const char* key;
  1595. /*!
  1596. * Value.
  1597. */
  1598. const char* value;
  1599. #ifdef __cplusplus
  1600. /*!
  1601. * Check if valid.
  1602. */
  1603. bool isValid() const noexcept
  1604. {
  1605. if (type == nullptr || type[0] == '\0') return false;
  1606. if (key == nullptr || key [0] == '\0') return false;
  1607. if (value == nullptr) return false;
  1608. return true;
  1609. }
  1610. #endif /* __cplusplus */
  1611. } CustomData;
  1612. /*!
  1613. * Engine driver device information.
  1614. */
  1615. typedef struct {
  1616. /*!
  1617. * This driver device hints.
  1618. * @see EngineDriverHints
  1619. */
  1620. uint hints;
  1621. /*!
  1622. * Available buffer sizes.
  1623. * Terminated with 0.
  1624. */
  1625. const uint32_t* bufferSizes;
  1626. /*!
  1627. * Available sample rates.
  1628. * Terminated with 0.0.
  1629. */
  1630. const double* sampleRates;
  1631. } EngineDriverDeviceInfo;
  1632. /** @} */
  1633. #ifdef __cplusplus
  1634. /* Forward declarations of commonly used Carla classes */
  1635. class CarlaEngine;
  1636. class CarlaEngineClient;
  1637. class CarlaEngineCVSourcePorts;
  1638. class CarlaPlugin;
  1639. /* End namespace */
  1640. CARLA_BACKEND_END_NAMESPACE
  1641. #endif
  1642. #endif /* CARLA_BACKEND_H_INCLUDED */