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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992
  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. /*!
  549. * CLAP plugin.
  550. */
  551. PLUGIN_CLAP = 14
  552. } PluginType;
  553. /* ------------------------------------------------------------------------------------------------------------
  554. * Plugin Category */
  555. /*!
  556. * Plugin category, which describes the functionality of a plugin.
  557. */
  558. typedef enum {
  559. /*!
  560. * Null plugin category.
  561. */
  562. PLUGIN_CATEGORY_NONE = 0,
  563. /*!
  564. * A synthesizer or generator.
  565. */
  566. PLUGIN_CATEGORY_SYNTH = 1,
  567. /*!
  568. * A delay or reverb.
  569. */
  570. PLUGIN_CATEGORY_DELAY = 2,
  571. /*!
  572. * An equalizer.
  573. */
  574. PLUGIN_CATEGORY_EQ = 3,
  575. /*!
  576. * A filter.
  577. */
  578. PLUGIN_CATEGORY_FILTER = 4,
  579. /*!
  580. * A distortion plugin.
  581. */
  582. PLUGIN_CATEGORY_DISTORTION = 5,
  583. /*!
  584. * A 'dynamic' plugin (amplifier, compressor, gate, etc).
  585. */
  586. PLUGIN_CATEGORY_DYNAMICS = 6,
  587. /*!
  588. * A 'modulator' plugin (chorus, flanger, phaser, etc).
  589. */
  590. PLUGIN_CATEGORY_MODULATOR = 7,
  591. /*!
  592. * An 'utility' plugin (analyzer, converter, mixer, etc).
  593. */
  594. PLUGIN_CATEGORY_UTILITY = 8,
  595. /*!
  596. * Miscellaneous plugin (used to check if the plugin has a category).
  597. */
  598. PLUGIN_CATEGORY_OTHER = 9
  599. } PluginCategory;
  600. /* ------------------------------------------------------------------------------------------------------------
  601. * Parameter Type */
  602. /*!
  603. * Plugin parameter type.
  604. */
  605. typedef enum {
  606. /*!
  607. * Null parameter type.
  608. */
  609. PARAMETER_UNKNOWN = 0,
  610. /*!
  611. * Input parameter.
  612. */
  613. PARAMETER_INPUT = 1,
  614. /*!
  615. * Output parameter.
  616. */
  617. PARAMETER_OUTPUT = 2
  618. } ParameterType;
  619. /* ------------------------------------------------------------------------------------------------------------
  620. * Internal Parameter Index */
  621. /*!
  622. * Special parameters used internally in Carla.
  623. * Plugins do not know about their existence.
  624. */
  625. typedef enum {
  626. /*!
  627. * Null parameter.
  628. */
  629. PARAMETER_NULL = -1,
  630. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  631. /*!
  632. * Active parameter, boolean type.
  633. * Default is 'false'.
  634. */
  635. PARAMETER_ACTIVE = -2,
  636. /*!
  637. * Dry/Wet parameter.
  638. * Range 0.0...1.0; default is 1.0.
  639. */
  640. PARAMETER_DRYWET = -3,
  641. /*!
  642. * Volume parameter.
  643. * Range 0.0...1.27; default is 1.0.
  644. */
  645. PARAMETER_VOLUME = -4,
  646. /*!
  647. * Stereo Balance-Left parameter.
  648. * Range -1.0...1.0; default is -1.0.
  649. */
  650. PARAMETER_BALANCE_LEFT = -5,
  651. /*!
  652. * Stereo Balance-Right parameter.
  653. * Range -1.0...1.0; default is 1.0.
  654. */
  655. PARAMETER_BALANCE_RIGHT = -6,
  656. /*!
  657. * Mono Panning parameter.
  658. * Range -1.0...1.0; default is 0.0.
  659. */
  660. PARAMETER_PANNING = -7,
  661. /*!
  662. * MIDI Control channel, integer type.
  663. * Range -1...15 (-1 = off).
  664. */
  665. PARAMETER_CTRL_CHANNEL = -8,
  666. #endif
  667. /*!
  668. * Max value, defined only for convenience.
  669. */
  670. PARAMETER_MAX = -9
  671. } InternalParameterIndex;
  672. /* ------------------------------------------------------------------------------------------------------------
  673. * Special Mapped Control Index */
  674. /*!
  675. * Specially designated mapped control indexes.
  676. * Values between 0 and 119 (0x77) are reserved for MIDI CC, which uses direct values.
  677. * @see ParameterData::mappedControlIndex
  678. */
  679. typedef enum {
  680. /*!
  681. * Unused control index, meaning no mapping is enabled.
  682. */
  683. CONTROL_INDEX_NONE = -1,
  684. /*!
  685. * CV control index, meaning the parameter is exposed as CV port.
  686. */
  687. CONTROL_INDEX_CV = 130,
  688. /*!
  689. * Special value to indicate MIDI pitchbend.
  690. */
  691. CONTROL_INDEX_MIDI_PITCHBEND = 131,
  692. /*!
  693. * Special value to indicate MIDI learn.
  694. */
  695. CONTROL_INDEX_MIDI_LEARN = 132,
  696. /*!
  697. * Highest index allowed for mappings.
  698. */
  699. CONTROL_INDEX_MAX_ALLOWED = CONTROL_INDEX_MIDI_LEARN
  700. } SpecialMappedControlIndex;
  701. /* ------------------------------------------------------------------------------------------------------------
  702. * Engine Callback Opcode */
  703. /*!
  704. * Engine callback opcodes.
  705. * Front-ends must never block indefinitely during a callback.
  706. * @see EngineCallbackFunc, CarlaEngine::setCallback() and carla_set_engine_callback()
  707. */
  708. typedef enum {
  709. /*!
  710. * Debug.
  711. * This opcode is undefined and used only for testing purposes.
  712. */
  713. ENGINE_CALLBACK_DEBUG = 0,
  714. /*!
  715. * A plugin has been added.
  716. * @a pluginId Plugin Id
  717. * @a value1 Plugin type
  718. * @a valueStr Plugin name
  719. */
  720. ENGINE_CALLBACK_PLUGIN_ADDED = 1,
  721. /*!
  722. * A plugin has been removed.
  723. * @a pluginId Plugin Id
  724. */
  725. ENGINE_CALLBACK_PLUGIN_REMOVED = 2,
  726. /*!
  727. * A plugin has been renamed.
  728. * @a pluginId Plugin Id
  729. * @a valueStr New plugin name
  730. */
  731. ENGINE_CALLBACK_PLUGIN_RENAMED = 3,
  732. /*!
  733. * A plugin has become unavailable.
  734. * @a pluginId Plugin Id
  735. * @a valueStr Related error string
  736. */
  737. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4,
  738. /*!
  739. * A parameter value has changed.
  740. * @a pluginId Plugin Id
  741. * @a value1 Parameter index
  742. * @a valuef New parameter value
  743. */
  744. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5,
  745. /*!
  746. * A parameter default has changed.
  747. * @a pluginId Plugin Id
  748. * @a value1 Parameter index
  749. * @a valuef New default value
  750. */
  751. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6,
  752. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  753. /*!
  754. * A parameter's mapped control index has changed.
  755. * @a pluginId Plugin Id
  756. * @a value1 Parameter index
  757. * @a value2 New control index
  758. */
  759. ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED = 7,
  760. /*!
  761. * A parameter's MIDI channel has changed.
  762. * @a pluginId Plugin Id
  763. * @a value1 Parameter index
  764. * @a value2 New MIDI channel
  765. */
  766. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8,
  767. /*!
  768. * A plugin option has changed.
  769. * @a pluginId Plugin Id
  770. * @a value1 Option
  771. * @a value2 New on/off state (1 for on, 0 for off)
  772. * @see PluginOptions
  773. */
  774. ENGINE_CALLBACK_OPTION_CHANGED = 9,
  775. #endif
  776. /*!
  777. * The current program of a plugin has changed.
  778. * @a pluginId Plugin Id
  779. * @a value1 New program index
  780. */
  781. ENGINE_CALLBACK_PROGRAM_CHANGED = 10,
  782. /*!
  783. * The current MIDI program of a plugin has changed.
  784. * @a pluginId Plugin Id
  785. * @a value1 New MIDI program index
  786. */
  787. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11,
  788. /*!
  789. * A plugin's custom UI state has changed.
  790. * @a pluginId Plugin Id
  791. * @a value1 New state, as follows:
  792. * 0: UI is now hidden
  793. * 1: UI is now visible
  794. * -1: UI has crashed and should not be shown again
  795. */
  796. ENGINE_CALLBACK_UI_STATE_CHANGED = 12,
  797. /*!
  798. * A note has been pressed.
  799. * @a pluginId Plugin Id
  800. * @a value1 Channel
  801. * @a value2 Note
  802. * @a value3 Velocity
  803. */
  804. ENGINE_CALLBACK_NOTE_ON = 13,
  805. /*!
  806. * A note has been released.
  807. * @a pluginId Plugin Id
  808. * @a value1 Channel
  809. * @a value2 Note
  810. */
  811. ENGINE_CALLBACK_NOTE_OFF = 14,
  812. /*!
  813. * A plugin needs update.
  814. * @a pluginId Plugin Id
  815. */
  816. ENGINE_CALLBACK_UPDATE = 15,
  817. /*!
  818. * A plugin's data/information has changed.
  819. * @a pluginId Plugin Id
  820. */
  821. ENGINE_CALLBACK_RELOAD_INFO = 16,
  822. /*!
  823. * A plugin's parameters have changed.
  824. * @a pluginId Plugin Id
  825. */
  826. ENGINE_CALLBACK_RELOAD_PARAMETERS = 17,
  827. /*!
  828. * A plugin's programs have changed.
  829. * @a pluginId Plugin Id
  830. */
  831. ENGINE_CALLBACK_RELOAD_PROGRAMS = 18,
  832. /*!
  833. * A plugin state has changed.
  834. * @a pluginId Plugin Id
  835. */
  836. ENGINE_CALLBACK_RELOAD_ALL = 19,
  837. #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
  838. /*!
  839. * A patchbay client has been added.
  840. * @a pluginId Client Id
  841. * @a value1 Client icon
  842. * @a value2 Plugin Id (-1 if not a plugin)
  843. * @a valueStr Client name
  844. * @see PatchbayIcon
  845. */
  846. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20,
  847. /*!
  848. * A patchbay client has been removed.
  849. * @a pluginId Client Id
  850. */
  851. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21,
  852. /*!
  853. * A patchbay client has been renamed.
  854. * @a pluginId Client Id
  855. * @a valueStr New client name
  856. */
  857. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22,
  858. /*!
  859. * A patchbay client data has changed.
  860. * @a pluginId Client Id
  861. * @a value1 New icon
  862. * @a value2 New plugin Id (-1 if not a plugin)
  863. * @see PatchbayIcon
  864. */
  865. ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23,
  866. /*!
  867. * A patchbay port has been added.
  868. * @a pluginId Client Id
  869. * @a value1 Port Id
  870. * @a value2 Port hints
  871. * @a value3 Port group Id (0 for none)
  872. * @a valueStr Port name
  873. * @see PatchbayPortHints
  874. */
  875. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24,
  876. /*!
  877. * A patchbay port has been removed.
  878. * @a pluginId Client Id
  879. * @a value1 Port Id
  880. */
  881. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25,
  882. /*!
  883. * A patchbay port has changed (like the name or group Id).
  884. * @a pluginId Client Id
  885. * @a value1 Port Id
  886. * @a value2 Port hints
  887. * @a value3 Port group Id (0 for none)
  888. * @a valueStr Port name
  889. */
  890. ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED = 26,
  891. /*!
  892. * A patchbay connection has been added.
  893. * @a pluginId Connection Id
  894. * @a valueStr Out group and port plus in group and port, in "og:op:ig:ip" syntax.
  895. */
  896. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27,
  897. /*!
  898. * A patchbay connection has been removed.
  899. * @a pluginId Connection Id
  900. */
  901. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28,
  902. #endif
  903. /*!
  904. * Engine started.
  905. * @a pluginId How many plugins are known to be running
  906. * @a value1 Process mode
  907. * @a value2 Transport mode
  908. * @a value3 Buffer size
  909. * @a valuef Sample rate
  910. * @a valuestr Engine driver
  911. * @see EngineProcessMode
  912. * @see EngineTransportMode
  913. */
  914. ENGINE_CALLBACK_ENGINE_STARTED = 29,
  915. /*!
  916. * Engine stopped.
  917. */
  918. ENGINE_CALLBACK_ENGINE_STOPPED = 30,
  919. /*!
  920. * Engine process mode has changed.
  921. * @a value1 New process mode
  922. * @see EngineProcessMode
  923. */
  924. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31,
  925. /*!
  926. * Engine transport mode has changed.
  927. * @a value1 New transport mode
  928. * @a valueStr New transport features enabled
  929. * @see EngineTransportMode
  930. */
  931. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32,
  932. /*!
  933. * Engine buffer-size changed.
  934. * @a value1 New buffer size
  935. */
  936. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33,
  937. /*!
  938. * Engine sample-rate changed.
  939. * @a valuef New sample rate
  940. */
  941. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34,
  942. /*!
  943. * A cancelable action has been started or stopped.
  944. * @a pluginId Plugin Id the action relates to, -1 for none
  945. * @a value1 1 for action started, 0 for stopped
  946. * @a valueStr Action name
  947. */
  948. ENGINE_CALLBACK_CANCELABLE_ACTION = 35,
  949. /*!
  950. * Project has finished loading.
  951. */
  952. ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36,
  953. /*!
  954. * NSM callback, to be handled by a frontend.
  955. * Frontend must call carla_nsm_ready() with opcode as parameter as a response
  956. * @a value1 NSM opcode
  957. * @a value2 Integer value
  958. * @a valueStr String value
  959. * @see NsmCallbackOpcode
  960. */
  961. ENGINE_CALLBACK_NSM = 37,
  962. /*!
  963. * Idle frontend.
  964. * This is used by the engine during long operations that might block the frontend,
  965. * giving it the possibility to idle while the operation is still in place.
  966. */
  967. ENGINE_CALLBACK_IDLE = 38,
  968. /*!
  969. * Show a message as information.
  970. * @a valueStr The message
  971. */
  972. ENGINE_CALLBACK_INFO = 39,
  973. /*!
  974. * Show a message as an error.
  975. * @a valueStr The message
  976. */
  977. ENGINE_CALLBACK_ERROR = 40,
  978. /*!
  979. * The engine has crashed or malfunctioned and will no longer work.
  980. */
  981. ENGINE_CALLBACK_QUIT = 41,
  982. /*!
  983. * A plugin requested for its inline display to be redrawn.
  984. * @a pluginId Plugin Id to redraw
  985. */
  986. ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW = 42,
  987. /*!
  988. * A patchbay port group has been added.
  989. * @a pluginId Client Id
  990. * @a value1 Group Id (unique value within this client)
  991. * @a value2 Group hints
  992. * @a valueStr Group name
  993. * @see PatchbayPortGroupHints
  994. */
  995. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED = 43,
  996. /*!
  997. * A patchbay port group has been removed.
  998. * @a pluginId Client Id
  999. * @a value1 Group Id
  1000. */
  1001. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED = 44,
  1002. /*!
  1003. * A patchbay port group has changed.
  1004. * @a pluginId Client Id
  1005. * @a value1 Group Id
  1006. * @a value2 Group hints
  1007. * @a valueStr Group name
  1008. * @see PatchbayPortGroupHints
  1009. */
  1010. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED = 45,
  1011. /*!
  1012. * A parameter's mapped range has changed.
  1013. * @a pluginId Plugin Id
  1014. * @a value1 Parameter index
  1015. * @a valueStr New mapped range as "%f:%f" syntax
  1016. */
  1017. ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED = 46,
  1018. /*!
  1019. * A patchbay client position has changed.
  1020. * @a pluginId Client Id
  1021. * @a value1 X position 1
  1022. * @a value2 Y position 1
  1023. * @a value3 X position 2
  1024. * @a valuef Y position 2
  1025. */
  1026. ENGINE_CALLBACK_PATCHBAY_CLIENT_POSITION_CHANGED = 47,
  1027. /*!
  1028. * A plugin embed UI has been resized.
  1029. * @a pluginId Plugin Id to resize
  1030. * @a value1 New width
  1031. * @a value2 New height
  1032. */
  1033. ENGINE_CALLBACK_EMBED_UI_RESIZED = 48
  1034. } EngineCallbackOpcode;
  1035. /* ------------------------------------------------------------------------------------------------------------
  1036. * NSM Callback Opcode */
  1037. /*!
  1038. * NSM callback opcodes.
  1039. * @see ENGINE_CALLBACK_NSM
  1040. */
  1041. typedef enum {
  1042. /*!
  1043. * NSM is available and initialized.
  1044. */
  1045. NSM_CALLBACK_INIT = 0,
  1046. /*!
  1047. * Error from NSM side.
  1048. * @a valueInt Error code
  1049. * @a valueStr Error string
  1050. */
  1051. NSM_CALLBACK_ERROR = 1,
  1052. /*!
  1053. * Announce message.
  1054. * @a valueInt SM Flags (WIP, to be defined)
  1055. * @a valueStr SM Name
  1056. */
  1057. NSM_CALLBACK_ANNOUNCE = 2,
  1058. /*!
  1059. * Open message.
  1060. * @a valueStr Project filename
  1061. */
  1062. NSM_CALLBACK_OPEN = 3,
  1063. /*!
  1064. * Save message.
  1065. */
  1066. NSM_CALLBACK_SAVE = 4,
  1067. /*!
  1068. * Session-is-loaded message.
  1069. */
  1070. NSM_CALLBACK_SESSION_IS_LOADED = 5,
  1071. /*!
  1072. * Show-optional-gui message.
  1073. */
  1074. NSM_CALLBACK_SHOW_OPTIONAL_GUI = 6,
  1075. /*!
  1076. * Hide-optional-gui message.
  1077. */
  1078. NSM_CALLBACK_HIDE_OPTIONAL_GUI = 7,
  1079. /*!
  1080. * Set client name id message.
  1081. */
  1082. NSM_CALLBACK_SET_CLIENT_NAME_ID = 8
  1083. } NsmCallbackOpcode;
  1084. /* ------------------------------------------------------------------------------------------------------------
  1085. * Engine Option */
  1086. /*!
  1087. * Engine options.
  1088. * @see CarlaEngine::getOptions(), CarlaEngine::setOption() and carla_set_engine_option()
  1089. */
  1090. typedef enum {
  1091. /*!
  1092. * Debug.
  1093. * This option is undefined and used only for testing purposes.
  1094. */
  1095. ENGINE_OPTION_DEBUG = 0,
  1096. /*!
  1097. * Set the engine processing mode.
  1098. * Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_PATCHBAY for all other OSes.
  1099. * @see EngineProcessMode
  1100. */
  1101. ENGINE_OPTION_PROCESS_MODE = 1,
  1102. /*!
  1103. * Set the engine transport mode.
  1104. * Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  1105. * @see EngineTransportMode
  1106. */
  1107. ENGINE_OPTION_TRANSPORT_MODE = 2,
  1108. /*!
  1109. * Force mono plugins as stereo, by running 2 instances at the same time.
  1110. * Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  1111. * @note Not supported by all plugins
  1112. * @see PLUGIN_OPTION_FORCE_STEREO
  1113. */
  1114. ENGINE_OPTION_FORCE_STEREO = 3,
  1115. /*!
  1116. * Use plugin bridges whenever possible.
  1117. * Default is no, EXPERIMENTAL.
  1118. */
  1119. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4,
  1120. /*!
  1121. * Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  1122. * Default is yes.
  1123. */
  1124. ENGINE_OPTION_PREFER_UI_BRIDGES = 5,
  1125. /*!
  1126. * Make custom plugin UIs always-on-top.
  1127. * Default is yes.
  1128. */
  1129. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6,
  1130. /*!
  1131. * Maximum number of parameters allowed.
  1132. * Default is MAX_DEFAULT_PARAMETERS.
  1133. */
  1134. ENGINE_OPTION_MAX_PARAMETERS = 7,
  1135. /*!
  1136. * Reset Xrun counter after project load.
  1137. */
  1138. ENGINE_OPTION_RESET_XRUNS = 8,
  1139. /*!
  1140. * Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  1141. * Default is 4000 (4 seconds).
  1142. */
  1143. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 9,
  1144. /*!
  1145. * Audio buffer size.
  1146. * Default is 512.
  1147. */
  1148. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10,
  1149. /*!
  1150. * Audio sample rate.
  1151. * Default is 44100.
  1152. */
  1153. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11,
  1154. /*!
  1155. * Wherever to use 3 audio periods instead of the default 2.
  1156. * Default is false.
  1157. */
  1158. ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 12,
  1159. /*!
  1160. * Audio driver.
  1161. * Default depends on platform.
  1162. */
  1163. ENGINE_OPTION_AUDIO_DRIVER = 13,
  1164. /*!
  1165. * Audio device (within a driver).
  1166. * Default unset.
  1167. */
  1168. ENGINE_OPTION_AUDIO_DEVICE = 14,
  1169. #ifndef BUILD_BRIDGE
  1170. /*!
  1171. * Wherever to enable OSC support in the engine.
  1172. */
  1173. ENGINE_OPTION_OSC_ENABLED = 15,
  1174. /*!
  1175. * The network TCP port to use for OSC.
  1176. * A value of 0 means use a random port.
  1177. * A value of < 0 means to not enable the TCP port for OSC.
  1178. * @note Valid ports begin at 1024 and end at 32767 (inclusive)
  1179. */
  1180. ENGINE_OPTION_OSC_PORT_TCP = 16,
  1181. /*!
  1182. * The network UDP port to use for OSC.
  1183. * A value of 0 means use a random port.
  1184. * A value of < 0 means to not enable the UDP port for OSC.
  1185. * @note Disabling this option prevents DSSI UIs from working!
  1186. * @note Valid ports begin at 1024 and end at 32767 (inclusive)
  1187. */
  1188. ENGINE_OPTION_OSC_PORT_UDP = 17,
  1189. #endif
  1190. /*!
  1191. * Set path used for a specific file type.
  1192. * Uses value as the file format, valueStr as actual path.
  1193. */
  1194. ENGINE_OPTION_FILE_PATH = 18,
  1195. /*!
  1196. * Set path used for a specific plugin type.
  1197. * Uses value as the plugin format, valueStr as actual path.
  1198. * @see PluginType
  1199. */
  1200. ENGINE_OPTION_PLUGIN_PATH = 19,
  1201. /*!
  1202. * Set path to the binary files.
  1203. * Default unset.
  1204. * @note Must be set for plugin and UI bridges to work
  1205. */
  1206. ENGINE_OPTION_PATH_BINARIES = 20,
  1207. /*!
  1208. * Set path to the resource files.
  1209. * Default unset.
  1210. * @note Must be set for some internal plugins to work
  1211. */
  1212. ENGINE_OPTION_PATH_RESOURCES = 21,
  1213. /*!
  1214. * Prevent bad plugin and UI behaviour.
  1215. * @note: Linux only
  1216. */
  1217. ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 22,
  1218. /*!
  1219. * Set background color used in the frontend, so backend can do the same for plugin UIs.
  1220. */
  1221. ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR = 23,
  1222. /*!
  1223. * Set foreground color used in the frontend, so backend can do the same for plugin UIs.
  1224. */
  1225. ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR = 24,
  1226. /*!
  1227. * Set UI scaling used in the frontend, so backend can do the same for plugin UIs.
  1228. */
  1229. ENGINE_OPTION_FRONTEND_UI_SCALE = 25,
  1230. /*!
  1231. * Set frontend winId, used to define as parent window for plugin UIs.
  1232. */
  1233. ENGINE_OPTION_FRONTEND_WIN_ID = 26,
  1234. #if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
  1235. /*!
  1236. * Set path to wine executable.
  1237. */
  1238. ENGINE_OPTION_WINE_EXECUTABLE = 27,
  1239. /*!
  1240. * Enable automatic wineprefix detection.
  1241. */
  1242. ENGINE_OPTION_WINE_AUTO_PREFIX = 28,
  1243. /*!
  1244. * Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
  1245. */
  1246. ENGINE_OPTION_WINE_FALLBACK_PREFIX = 29,
  1247. /*!
  1248. * Enable realtime priority for Wine application and server threads.
  1249. */
  1250. ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 30,
  1251. /*!
  1252. * Base realtime priority for Wine threads.
  1253. */
  1254. ENGINE_OPTION_WINE_BASE_RT_PRIO = 31,
  1255. /*!
  1256. * Wine server realtime priority.
  1257. */
  1258. ENGINE_OPTION_WINE_SERVER_RT_PRIO = 32,
  1259. #endif
  1260. #ifndef BUILD_BRIDGE
  1261. /*!
  1262. * Capture console output into debug callbacks.
  1263. */
  1264. ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33,
  1265. #endif
  1266. /*!
  1267. * A prefix to give to all plugin clients created by Carla.
  1268. * Mostly useful for JACK multi-client mode.
  1269. * @note MUST include at least one "." (dot).
  1270. */
  1271. ENGINE_OPTION_CLIENT_NAME_PREFIX = 34,
  1272. /*!
  1273. * Treat loaded plugins as standalone (that is, there is no host UI to manage them)
  1274. */
  1275. ENGINE_OPTION_PLUGINS_ARE_STANDALONE = 35
  1276. } EngineOption;
  1277. /* ------------------------------------------------------------------------------------------------------------
  1278. * Engine Process Mode */
  1279. /*!
  1280. * Engine process mode.
  1281. * @see ENGINE_OPTION_PROCESS_MODE
  1282. */
  1283. typedef enum {
  1284. /*!
  1285. * Single client mode.
  1286. * Inputs and outputs are added dynamically as needed by plugins.
  1287. */
  1288. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0,
  1289. /*!
  1290. * Multiple client mode.
  1291. * It has 1 master client + 1 client per plugin.
  1292. */
  1293. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1,
  1294. /*!
  1295. * Single client, 'rack' mode.
  1296. * Processes plugins in order of Id, with forced stereo always on.
  1297. */
  1298. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2,
  1299. /*!
  1300. * Single client, 'patchbay' mode.
  1301. */
  1302. ENGINE_PROCESS_MODE_PATCHBAY = 3,
  1303. /*!
  1304. * Special mode, used in plugin-bridges only.
  1305. */
  1306. ENGINE_PROCESS_MODE_BRIDGE = 4
  1307. } EngineProcessMode;
  1308. /* ------------------------------------------------------------------------------------------------------------
  1309. * Engine Transport Mode */
  1310. /*!
  1311. * Engine transport mode.
  1312. * @see ENGINE_OPTION_TRANSPORT_MODE
  1313. */
  1314. typedef enum {
  1315. /*!
  1316. * No transport.
  1317. */
  1318. ENGINE_TRANSPORT_MODE_DISABLED = 0,
  1319. /*!
  1320. * Internal transport mode.
  1321. */
  1322. ENGINE_TRANSPORT_MODE_INTERNAL = 1,
  1323. /*!
  1324. * Transport from JACK.
  1325. * Only available if driver name is "JACK".
  1326. */
  1327. ENGINE_TRANSPORT_MODE_JACK = 2,
  1328. /*!
  1329. * Transport from host, used when Carla is a plugin.
  1330. */
  1331. ENGINE_TRANSPORT_MODE_PLUGIN = 3,
  1332. /*!
  1333. * Special mode, used in plugin-bridges only.
  1334. */
  1335. ENGINE_TRANSPORT_MODE_BRIDGE = 4
  1336. } EngineTransportMode;
  1337. /* ------------------------------------------------------------------------------------------------------------
  1338. * File Callback Opcode */
  1339. /*!
  1340. * File callback opcodes.
  1341. * Front-ends must always block-wait for user input.
  1342. * @see FileCallbackFunc, CarlaEngine::setFileCallback() and carla_set_file_callback()
  1343. */
  1344. typedef enum {
  1345. /*!
  1346. * Debug.
  1347. * This opcode is undefined and used only for testing purposes.
  1348. */
  1349. FILE_CALLBACK_DEBUG = 0,
  1350. /*!
  1351. * Open file or folder.
  1352. */
  1353. FILE_CALLBACK_OPEN = 1,
  1354. /*!
  1355. * Save file or folder.
  1356. */
  1357. FILE_CALLBACK_SAVE = 2
  1358. } FileCallbackOpcode;
  1359. /* ------------------------------------------------------------------------------------------------------------
  1360. * Patchbay Icon */
  1361. /*!
  1362. * The icon of a patchbay client/group.
  1363. */
  1364. enum PatchbayIcon {
  1365. /*!
  1366. * Generic application icon.
  1367. * Used for all non-plugin clients that don't have a specific icon.
  1368. */
  1369. PATCHBAY_ICON_APPLICATION = 0,
  1370. /*!
  1371. * Plugin icon.
  1372. * Used for all plugin clients that don't have a specific icon.
  1373. */
  1374. PATCHBAY_ICON_PLUGIN = 1,
  1375. /*!
  1376. * Hardware icon.
  1377. * Used for hardware (audio or MIDI) clients.
  1378. */
  1379. PATCHBAY_ICON_HARDWARE = 2,
  1380. /*!
  1381. * Carla icon.
  1382. * Used for the main app.
  1383. */
  1384. PATCHBAY_ICON_CARLA = 3,
  1385. /*!
  1386. * DISTRHO icon.
  1387. * Used for DISTRHO based plugins.
  1388. */
  1389. PATCHBAY_ICON_DISTRHO = 4,
  1390. /*!
  1391. * File icon.
  1392. * Used for file type plugins (like SF2 snd SFZ).
  1393. */
  1394. PATCHBAY_ICON_FILE = 5
  1395. };
  1396. /* ------------------------------------------------------------------------------------------------------------
  1397. * Carla Backend API (C stuff) */
  1398. /*!
  1399. * Engine callback function.
  1400. * Front-ends must never block indefinitely during a callback.
  1401. * @see EngineCallbackOpcode, CarlaEngine::setCallback() and carla_set_engine_callback()
  1402. */
  1403. typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackOpcode action, uint pluginId,
  1404. int value1, int value2, int value3,
  1405. float valuef, const char* valueStr);
  1406. /*!
  1407. * File callback function.
  1408. * @see FileCallbackOpcode
  1409. */
  1410. typedef const char* (*FileCallbackFunc)(void* ptr, FileCallbackOpcode action, bool isDir, const char* title, const char* filter);
  1411. /*!
  1412. * Parameter data.
  1413. */
  1414. typedef struct {
  1415. /*!
  1416. * This parameter type.
  1417. */
  1418. ParameterType type;
  1419. /*!
  1420. * This parameter hints.
  1421. * @see ParameterHints
  1422. */
  1423. uint hints;
  1424. /*!
  1425. * Index as seen by Carla.
  1426. */
  1427. int32_t index;
  1428. /*!
  1429. * Real index as seen by plugins.
  1430. */
  1431. int32_t rindex;
  1432. /*!
  1433. * Currently mapped MIDI channel.
  1434. * Counts from 0 to 15.
  1435. */
  1436. uint8_t midiChannel;
  1437. /*!
  1438. * Currently mapped index.
  1439. * @see SpecialMappedControlIndex
  1440. */
  1441. int16_t mappedControlIndex;
  1442. /*!
  1443. * Minimum value that this parameter maps to.
  1444. */
  1445. float mappedMinimum;
  1446. /*!
  1447. * Maximum value that this parameter maps to.
  1448. */
  1449. float mappedMaximum;
  1450. /*!
  1451. * Flags related to the current mapping of this parameter.
  1452. * @see MappedParameterFlags
  1453. */
  1454. uint mappedFlags;
  1455. } ParameterData;
  1456. /*!
  1457. * Parameter ranges.
  1458. */
  1459. typedef struct _ParameterRanges {
  1460. /*!
  1461. * Default value.
  1462. */
  1463. float def;
  1464. /*!
  1465. * Minimum value.
  1466. */
  1467. float min;
  1468. /*!
  1469. * Maximum value.
  1470. */
  1471. float max;
  1472. /*!
  1473. * Regular, single step value.
  1474. */
  1475. float step;
  1476. /*!
  1477. * Small step value.
  1478. */
  1479. float stepSmall;
  1480. /*!
  1481. * Large step value.
  1482. */
  1483. float stepLarge;
  1484. #ifdef __cplusplus
  1485. /*!
  1486. * Fix the default value within range.
  1487. */
  1488. void fixDefault() noexcept
  1489. {
  1490. fixValue(def);
  1491. }
  1492. /*!
  1493. * Fix a value within range.
  1494. */
  1495. void fixValue(float& value) const noexcept
  1496. {
  1497. if (value < min)
  1498. value = min;
  1499. else if (value > max)
  1500. value = max;
  1501. }
  1502. /*!
  1503. * Get a fixed value within range.
  1504. */
  1505. const float& getFixedValue(const float& value) const noexcept
  1506. {
  1507. if (value <= min)
  1508. return min;
  1509. if (value >= max)
  1510. return max;
  1511. return value;
  1512. }
  1513. /*!
  1514. * Get a value normalized to 0.0<->1.0.
  1515. */
  1516. float getNormalizedValue(const float& value) const noexcept
  1517. {
  1518. const float normValue((value - min) / (max - min));
  1519. if (normValue <= 0.0f)
  1520. return 0.0f;
  1521. if (normValue >= 1.0f)
  1522. return 1.0f;
  1523. return normValue;
  1524. }
  1525. /*!
  1526. * Get a value normalized to 0.0<->1.0, fixed within range.
  1527. */
  1528. float getFixedAndNormalizedValue(const float& value) const noexcept
  1529. {
  1530. if (value <= min)
  1531. return 0.0f;
  1532. if (value >= max)
  1533. return 1.0f;
  1534. const float normValue((value - min) / (max - min));
  1535. if (normValue <= 0.0f)
  1536. return 0.0f;
  1537. if (normValue >= 1.0f)
  1538. return 1.0f;
  1539. return normValue;
  1540. }
  1541. /*!
  1542. * Get a proper value previously normalized to 0.0<->1.0.
  1543. */
  1544. float getUnnormalizedValue(const float& value) const noexcept
  1545. {
  1546. if (value <= 0.0f)
  1547. return min;
  1548. if (value >= 1.0f)
  1549. return max;
  1550. return value * (max - min) + min;
  1551. }
  1552. /*!
  1553. * Get a logarithmic value previously normalized to 0.0<->1.0.
  1554. */
  1555. float getUnnormalizedLogValue(const float& value) const noexcept
  1556. {
  1557. if (value <= 0.0f)
  1558. return min;
  1559. if (value >= 1.0f)
  1560. return max;
  1561. float rmin = min;
  1562. if (std::abs(min) < std::numeric_limits<float>::epsilon())
  1563. rmin = 0.00001f;
  1564. return rmin * std::pow(max/rmin, value);
  1565. }
  1566. #endif /* __cplusplus */
  1567. } ParameterRanges;
  1568. /*!
  1569. * MIDI Program data.
  1570. */
  1571. typedef struct {
  1572. /*!
  1573. * MIDI bank.
  1574. */
  1575. uint32_t bank;
  1576. /*!
  1577. * MIDI program.
  1578. */
  1579. uint32_t program;
  1580. /*!
  1581. * MIDI program name.
  1582. */
  1583. const char* name;
  1584. } MidiProgramData;
  1585. /*!
  1586. * Custom data, used for saving key:value 'dictionaries'.
  1587. */
  1588. typedef struct _CustomData {
  1589. /*!
  1590. * Value type, in URI form.
  1591. * @see CustomDataTypes
  1592. */
  1593. const char* type;
  1594. /*!
  1595. * Key.
  1596. * @see CustomDataKeys
  1597. */
  1598. const char* key;
  1599. /*!
  1600. * Value.
  1601. */
  1602. const char* value;
  1603. #ifdef __cplusplus
  1604. /*!
  1605. * Check if valid.
  1606. */
  1607. bool isValid() const noexcept
  1608. {
  1609. if (type == nullptr || type[0] == '\0') return false;
  1610. if (key == nullptr || key [0] == '\0') return false;
  1611. if (value == nullptr) return false;
  1612. return true;
  1613. }
  1614. #endif /* __cplusplus */
  1615. } CustomData;
  1616. /*!
  1617. * Engine driver device information.
  1618. */
  1619. typedef struct {
  1620. /*!
  1621. * This driver device hints.
  1622. * @see EngineDriverHints
  1623. */
  1624. uint hints;
  1625. /*!
  1626. * Available buffer sizes.
  1627. * Terminated with 0.
  1628. */
  1629. const uint32_t* bufferSizes;
  1630. /*!
  1631. * Available sample rates.
  1632. * Terminated with 0.0.
  1633. */
  1634. const double* sampleRates;
  1635. } EngineDriverDeviceInfo;
  1636. /** @} */
  1637. #ifdef __cplusplus
  1638. /* Forward declarations of commonly used Carla classes */
  1639. class CarlaEngine;
  1640. class CarlaEngineClient;
  1641. class CarlaEngineCVSourcePorts;
  1642. class CarlaPlugin;
  1643. /* End namespace */
  1644. CARLA_BACKEND_END_NAMESPACE
  1645. #endif
  1646. #endif /* CARLA_BACKEND_H_INCLUDED */