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 44KB

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