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

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