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

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