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

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