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

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
10 years ago
10 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
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
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
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535
  1. /*
  2. * Carla Plugin Host
  3. * Copyright (C) 2011-2017 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 <cmath>
  31. /* Start namespace */
  32. CARLA_BACKEND_START_NAMESPACE
  33. #endif
  34. /*!
  35. * @defgroup CarlaBackendAPI Carla Backend API
  36. *
  37. * The Carla Backend API.
  38. *
  39. * These are the base definitions for everything in the Carla backend code.
  40. * @{
  41. */
  42. /* ------------------------------------------------------------------------------------------------------------
  43. * Carla Backend API (base definitions) */
  44. /*!
  45. * Maximum default number of loadable plugins.
  46. */
  47. static const uint MAX_DEFAULT_PLUGINS = 99;
  48. /*!
  49. * Maximum number of loadable plugins in rack mode.
  50. */
  51. static const uint MAX_RACK_PLUGINS = 16;
  52. /*!
  53. * Maximum number of loadable plugins in patchbay mode.
  54. */
  55. static const uint MAX_PATCHBAY_PLUGINS = 255;
  56. /*!
  57. * Maximum default number of parameters allowed.
  58. * @see ENGINE_OPTION_MAX_PARAMETERS
  59. */
  60. static const uint MAX_DEFAULT_PARAMETERS = 200;
  61. /* ------------------------------------------------------------------------------------------------------------
  62. * Engine Driver Device Hints */
  63. /*!
  64. * @defgroup EngineDriverHints Engine Driver Device Hints
  65. *
  66. * Various engine driver device hints.
  67. * @see CarlaEngine::getHints(), CarlaEngine::getDriverDeviceInfo() and carla_get_engine_driver_device_info()
  68. * @{
  69. */
  70. /*!
  71. * Engine driver device has custom control-panel.
  72. */
  73. static const uint ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1;
  74. /*!
  75. * Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
  76. * @see ENGINE_OPTION_AUDIO_NUM_PERIODS
  77. */
  78. static const uint ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2;
  79. /*!
  80. * Engine driver device can change buffer-size on the fly.
  81. * @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
  82. */
  83. static const uint ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4;
  84. /*!
  85. * Engine driver device can change sample-rate on the fly.
  86. * @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
  87. */
  88. static const uint ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8;
  89. /** @} */
  90. /* ------------------------------------------------------------------------------------------------------------
  91. * Plugin Hints */
  92. /*!
  93. * @defgroup PluginHints Plugin Hints
  94. *
  95. * Various plugin hints.
  96. * @see CarlaPlugin::getHints() and carla_get_plugin_info()
  97. * @{
  98. */
  99. /*!
  100. * Plugin is a bridge.
  101. * This hint is required because "bridge" itself is not a plugin type.
  102. */
  103. static const uint PLUGIN_IS_BRIDGE = 0x001;
  104. /*!
  105. * Plugin is hard real-time safe.
  106. */
  107. static const uint PLUGIN_IS_RTSAFE = 0x002;
  108. /*!
  109. * Plugin is a synth (produces sound).
  110. */
  111. static const uint PLUGIN_IS_SYNTH = 0x004;
  112. /*!
  113. * Plugin has its own custom UI.
  114. * @see CarlaPlugin::showCustomUI() and carla_show_custom_ui()
  115. */
  116. static const uint PLUGIN_HAS_CUSTOM_UI = 0x008;
  117. /*!
  118. * Plugin can use internal Dry/Wet control.
  119. */
  120. static const uint PLUGIN_CAN_DRYWET = 0x010;
  121. /*!
  122. * Plugin can use internal Volume control.
  123. */
  124. static const uint PLUGIN_CAN_VOLUME = 0x020;
  125. /*!
  126. * Plugin can use internal (Stereo) Balance controls.
  127. */
  128. static const uint PLUGIN_CAN_BALANCE = 0x040;
  129. /*!
  130. * Plugin can use internal (Mono) Panning control.
  131. */
  132. static const uint PLUGIN_CAN_PANNING = 0x080;
  133. /*!
  134. * Plugin needs a constant, fixed-size audio buffer.
  135. */
  136. static const uint PLUGIN_NEEDS_FIXED_BUFFERS = 0x100;
  137. /*!
  138. * Plugin needs to receive all UI events in the main thread.
  139. */
  140. static const uint PLUGIN_NEEDS_UI_MAIN_THREAD = 0x200;
  141. /*!
  142. * Plugin uses 1 program per MIDI channel.
  143. * @note: Only used in some internal plugins and gig+sf2 files.
  144. */
  145. static const uint PLUGIN_USES_MULTI_PROGS = 0x400;
  146. /*!
  147. * Plugin can make use of inline display API.
  148. */
  149. static const uint PLUGIN_HAS_INLINE_DISPLAY = 0x800;
  150. /** @} */
  151. /* ------------------------------------------------------------------------------------------------------------
  152. * Plugin Options */
  153. /*!
  154. * @defgroup PluginOptions Plugin Options
  155. *
  156. * Various plugin options.
  157. * @see CarlaPlugin::getOptionsAvailable(), CarlaPlugin::getOptionsEnabled(), carla_get_plugin_info() and carla_set_option()
  158. * @{
  159. */
  160. /*!
  161. * Use constant/fixed-size audio buffers.
  162. */
  163. static const uint PLUGIN_OPTION_FIXED_BUFFERS = 0x001;
  164. /*!
  165. * Force mono plugin as stereo.
  166. */
  167. static const uint PLUGIN_OPTION_FORCE_STEREO = 0x002;
  168. /*!
  169. * Map MIDI programs to plugin programs.
  170. */
  171. static const uint PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004;
  172. /*!
  173. * Use chunks to save and restore data instead of parameter values.
  174. */
  175. static const uint PLUGIN_OPTION_USE_CHUNKS = 0x008;
  176. /*!
  177. * Send MIDI control change events.
  178. */
  179. static const uint PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010;
  180. /*!
  181. * Send MIDI channel pressure events.
  182. */
  183. static const uint PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020;
  184. /*!
  185. * Send MIDI note after-touch events.
  186. */
  187. static const uint PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040;
  188. /*!
  189. * Send MIDI pitch-bend events.
  190. */
  191. static const uint PLUGIN_OPTION_SEND_PITCHBEND = 0x080;
  192. /*!
  193. * Send MIDI all-sounds/notes-off events, single note-offs otherwise.
  194. */
  195. static const uint PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100;
  196. /*!
  197. * Send MIDI bank/program changes.
  198. * @note: This option conflicts with PLUGIN_OPTION_MAP_PROGRAM_CHANGES and cannot be used at the same time.
  199. */
  200. static const uint PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200;
  201. /** @} */
  202. /* ------------------------------------------------------------------------------------------------------------
  203. * Parameter Hints */
  204. /*!
  205. * @defgroup ParameterHints Parameter Hints
  206. *
  207. * Various parameter hints.
  208. * @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
  209. * @{
  210. */
  211. /*!
  212. * Parameter value is boolean.
  213. * It's always at either minimum or maximum value.
  214. */
  215. static const uint PARAMETER_IS_BOOLEAN = 0x001;
  216. /*!
  217. * Parameter value is integer.
  218. */
  219. static const uint PARAMETER_IS_INTEGER = 0x002;
  220. /*!
  221. * Parameter value is logarithmic.
  222. */
  223. static const uint PARAMETER_IS_LOGARITHMIC = 0x004;
  224. /*!
  225. * Parameter is enabled.
  226. * It can be viewed, changed and stored.
  227. */
  228. static const uint PARAMETER_IS_ENABLED = 0x010;
  229. /*!
  230. * Parameter is automable (real-time safe).
  231. */
  232. static const uint PARAMETER_IS_AUTOMABLE = 0x020;
  233. /*!
  234. * Parameter is read-only.
  235. * It cannot be changed.
  236. */
  237. static const uint PARAMETER_IS_READ_ONLY = 0x040;
  238. /*!
  239. * Parameter needs sample rate to work.
  240. * Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
  241. */
  242. static const uint PARAMETER_USES_SAMPLERATE = 0x100;
  243. /*!
  244. * Parameter uses scale points to define internal values in a meaningful way.
  245. */
  246. static const uint PARAMETER_USES_SCALEPOINTS = 0x200;
  247. /*!
  248. * Parameter uses custom text for displaying its value.
  249. * @see CarlaPlugin::getParameterText() and carla_get_parameter_text()
  250. */
  251. static const uint PARAMETER_USES_CUSTOM_TEXT = 0x400;
  252. /** @} */
  253. /* ------------------------------------------------------------------------------------------------------------
  254. * Patchbay Port Hints */
  255. /*!
  256. * @defgroup PatchbayPortHints Patchbay Port Hints
  257. *
  258. * Various patchbay port hints.
  259. * @{
  260. */
  261. /*!
  262. * Patchbay port is input.
  263. * When this hint is not set, port is assumed to be output.
  264. */
  265. static const uint PATCHBAY_PORT_IS_INPUT = 0x1;
  266. /*!
  267. * Patchbay port is of Audio type.
  268. */
  269. static const uint PATCHBAY_PORT_TYPE_AUDIO = 0x2;
  270. /*!
  271. * Patchbay port is of CV type (Control Voltage).
  272. */
  273. static const uint PATCHBAY_PORT_TYPE_CV = 0x4;
  274. /*!
  275. * Patchbay port is of MIDI type.
  276. */
  277. static const uint PATCHBAY_PORT_TYPE_MIDI = 0x8;
  278. /** @} */
  279. /* ------------------------------------------------------------------------------------------------------------
  280. * Custom Data Types */
  281. /*!
  282. * @defgroup CustomDataTypes Custom Data Types
  283. *
  284. * These types define how the value in the CustomData struct is stored.
  285. * @see CustomData::type
  286. * @{
  287. */
  288. /*!
  289. * Boolean string type URI.
  290. * Only "true" and "false" are valid values.
  291. */
  292. static const char* const CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean";
  293. /*!
  294. * Chunk type URI.
  295. */
  296. static const char* const CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk";
  297. /*!
  298. * Property type URI.
  299. */
  300. static const char* const CUSTOM_DATA_TYPE_PROPERTY = "http://kxstudio.sf.net/ns/carla/property";
  301. /*!
  302. * String type URI.
  303. */
  304. static const char* const CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string";
  305. /** @} */
  306. /* ------------------------------------------------------------------------------------------------------------
  307. * Custom Data Keys */
  308. /*!
  309. * @defgroup CustomDataKeys Custom Data Keys
  310. *
  311. * Pre-defined keys used internally in Carla.
  312. * @see CustomData::key
  313. * @{
  314. */
  315. /*!
  316. * UI position key.
  317. */
  318. static const char* const CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition";
  319. /*!
  320. * UI size key.
  321. */
  322. static const char* const CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize";
  323. /*!
  324. * UI visible key.
  325. */
  326. static const char* const CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible";
  327. /** @} */
  328. /* ------------------------------------------------------------------------------------------------------------
  329. * Binary Type */
  330. /*!
  331. * The binary type of a plugin.
  332. */
  333. typedef enum {
  334. /*!
  335. * Null binary type.
  336. */
  337. BINARY_NONE = 0,
  338. /*!
  339. * POSIX 32bit binary.
  340. */
  341. BINARY_POSIX32 = 1,
  342. /*!
  343. * POSIX 64bit binary.
  344. */
  345. BINARY_POSIX64 = 2,
  346. /*!
  347. * Windows 32bit binary.
  348. */
  349. BINARY_WIN32 = 3,
  350. /*!
  351. * Windows 64bit binary.
  352. */
  353. BINARY_WIN64 = 4,
  354. /*!
  355. * Other binary type.
  356. */
  357. BINARY_OTHER = 5
  358. } BinaryType;
  359. /* ------------------------------------------------------------------------------------------------------------
  360. * Plugin Type */
  361. /*!
  362. * Plugin type.
  363. * Some files are handled as if they were plugins.
  364. */
  365. typedef enum {
  366. /*!
  367. * Null plugin type.
  368. */
  369. PLUGIN_NONE = 0,
  370. /*!
  371. * Internal plugin.
  372. */
  373. PLUGIN_INTERNAL = 1,
  374. /*!
  375. * LADSPA plugin.
  376. */
  377. PLUGIN_LADSPA = 2,
  378. /*!
  379. * DSSI plugin.
  380. */
  381. PLUGIN_DSSI = 3,
  382. /*!
  383. * LV2 plugin.
  384. */
  385. PLUGIN_LV2 = 4,
  386. /*!
  387. * VST2 plugin.
  388. */
  389. PLUGIN_VST2 = 5,
  390. /*!
  391. * GIG file.
  392. */
  393. PLUGIN_GIG = 6,
  394. /*!
  395. * SF2 file (SoundFont).
  396. */
  397. PLUGIN_SF2 = 7,
  398. /*!
  399. * SFZ file.
  400. */
  401. PLUGIN_SFZ = 8,
  402. /*!
  403. * JACK application.
  404. */
  405. PLUGIN_JACK = 9
  406. } PluginType;
  407. /* ------------------------------------------------------------------------------------------------------------
  408. * Plugin Category */
  409. /*!
  410. * Plugin category, which describes the functionality of a plugin.
  411. */
  412. typedef enum {
  413. /*!
  414. * Null plugin category.
  415. */
  416. PLUGIN_CATEGORY_NONE = 0,
  417. /*!
  418. * A synthesizer or generator.
  419. */
  420. PLUGIN_CATEGORY_SYNTH = 1,
  421. /*!
  422. * A delay or reverb.
  423. */
  424. PLUGIN_CATEGORY_DELAY = 2,
  425. /*!
  426. * An equalizer.
  427. */
  428. PLUGIN_CATEGORY_EQ = 3,
  429. /*!
  430. * A filter.
  431. */
  432. PLUGIN_CATEGORY_FILTER = 4,
  433. /*!
  434. * A distortion plugin.
  435. */
  436. PLUGIN_CATEGORY_DISTORTION = 5,
  437. /*!
  438. * A 'dynamic' plugin (amplifier, compressor, gate, etc).
  439. */
  440. PLUGIN_CATEGORY_DYNAMICS = 6,
  441. /*!
  442. * A 'modulator' plugin (chorus, flanger, phaser, etc).
  443. */
  444. PLUGIN_CATEGORY_MODULATOR = 7,
  445. /*!
  446. * An 'utility' plugin (analyzer, converter, mixer, etc).
  447. */
  448. PLUGIN_CATEGORY_UTILITY = 8,
  449. /*!
  450. * Miscellaneous plugin (used to check if the plugin has a category).
  451. */
  452. PLUGIN_CATEGORY_OTHER = 9
  453. } PluginCategory;
  454. /* ------------------------------------------------------------------------------------------------------------
  455. * Parameter Type */
  456. /*!
  457. * Plugin parameter type.
  458. */
  459. typedef enum {
  460. /*!
  461. * Null parameter type.
  462. */
  463. PARAMETER_UNKNOWN = 0,
  464. /*!
  465. * Input parameter.
  466. */
  467. PARAMETER_INPUT = 1,
  468. /*!
  469. * Ouput parameter.
  470. */
  471. PARAMETER_OUTPUT = 2
  472. } ParameterType;
  473. /* ------------------------------------------------------------------------------------------------------------
  474. * Internal Parameter Index */
  475. /*!
  476. * Special parameters used internally in Carla.
  477. * Plugins do not know about their existence.
  478. */
  479. typedef enum {
  480. /*!
  481. * Null parameter.
  482. */
  483. PARAMETER_NULL = -1,
  484. #ifndef BUILD_BRIDGE
  485. /*!
  486. * Active parameter, boolean type.
  487. * Default is 'false'.
  488. */
  489. PARAMETER_ACTIVE = -2,
  490. /*!
  491. * Dry/Wet parameter.
  492. * Range 0.0...1.0; default is 1.0.
  493. */
  494. PARAMETER_DRYWET = -3,
  495. /*!
  496. * Volume parameter.
  497. * Range 0.0...1.27; default is 1.0.
  498. */
  499. PARAMETER_VOLUME = -4,
  500. /*!
  501. * Stereo Balance-Left parameter.
  502. * Range -1.0...1.0; default is -1.0.
  503. */
  504. PARAMETER_BALANCE_LEFT = -5,
  505. /*!
  506. * Stereo Balance-Right parameter.
  507. * Range -1.0...1.0; default is 1.0.
  508. */
  509. PARAMETER_BALANCE_RIGHT = -6,
  510. /*!
  511. * Mono Panning parameter.
  512. * Range -1.0...1.0; default is 0.0.
  513. */
  514. PARAMETER_PANNING = -7,
  515. /*!
  516. * MIDI Control channel, integer type.
  517. * Range -1...15 (-1 = off).
  518. */
  519. PARAMETER_CTRL_CHANNEL = -8,
  520. #endif
  521. /*!
  522. * Max value, defined only for convenience.
  523. */
  524. PARAMETER_MAX = -9
  525. } InternalParameterIndex;
  526. /* ------------------------------------------------------------------------------------------------------------
  527. * Engine Callback Opcode */
  528. /*!
  529. * Engine callback opcodes.
  530. * Front-ends must never block indefinitely during a callback.
  531. * @see EngineCallbackFunc, CarlaEngine::setCallback() and carla_set_engine_callback()
  532. */
  533. typedef enum {
  534. /*!
  535. * Debug.
  536. * This opcode is undefined and used only for testing purposes.
  537. */
  538. ENGINE_CALLBACK_DEBUG = 0,
  539. /*!
  540. * A plugin has been added.
  541. * @a pluginId Plugin Id
  542. * @a valueStr Plugin name
  543. */
  544. ENGINE_CALLBACK_PLUGIN_ADDED = 1,
  545. /*!
  546. * A plugin has been removed.
  547. * @a pluginId Plugin Id
  548. */
  549. ENGINE_CALLBACK_PLUGIN_REMOVED = 2,
  550. /*!
  551. * A plugin has been renamed.
  552. * @a pluginId Plugin Id
  553. * @a valueStr New plugin name
  554. */
  555. ENGINE_CALLBACK_PLUGIN_RENAMED = 3,
  556. /*!
  557. * A plugin has become unavailable.
  558. * @a pluginId Plugin Id
  559. * @a valueStr Related error string
  560. */
  561. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4,
  562. /*!
  563. * A parameter value has changed.
  564. * @a pluginId Plugin Id
  565. * @a value1 Parameter index
  566. * @a value3 New parameter value
  567. */
  568. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5,
  569. /*!
  570. * A parameter default has changed.
  571. * @a pluginId Plugin Id
  572. * @a value1 Parameter index
  573. * @a value3 New default value
  574. */
  575. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6,
  576. #ifndef BUILD_BRIDGE
  577. /*!
  578. * A parameter's MIDI CC has changed.
  579. * @a pluginId Plugin Id
  580. * @a value1 Parameter index
  581. * @a value2 New MIDI CC
  582. */
  583. ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7,
  584. /*!
  585. * A parameter's MIDI channel has changed.
  586. * @a pluginId Plugin Id
  587. * @a value1 Parameter index
  588. * @a value2 New MIDI channel
  589. */
  590. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8,
  591. /*!
  592. * A plugin option has changed.
  593. * @a pluginId Plugin Id
  594. * @a value1 Option
  595. * @a value2 New on/off state (1 for on, 0 for off)
  596. * @see PluginOptions
  597. */
  598. ENGINE_CALLBACK_OPTION_CHANGED = 9,
  599. #endif
  600. /*!
  601. * The current program of a plugin has changed.
  602. * @a pluginId Plugin Id
  603. * @a value1 New program index
  604. */
  605. ENGINE_CALLBACK_PROGRAM_CHANGED = 10,
  606. /*!
  607. * The current MIDI program of a plugin has changed.
  608. * @a pluginId Plugin Id
  609. * @a value1 New MIDI program index
  610. */
  611. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11,
  612. /*!
  613. * A plugin's custom UI state has changed.
  614. * @a pluginId Plugin Id
  615. * @a value1 New state, as follows:
  616. * 0: UI is now hidden
  617. * 1: UI is now visible
  618. * -1: UI has crashed and should not be shown again
  619. */
  620. ENGINE_CALLBACK_UI_STATE_CHANGED = 12,
  621. /*!
  622. * A note has been pressed.
  623. * @a pluginId Plugin Id
  624. * @a value1 Channel
  625. * @a value2 Note
  626. * @a value3 Velocity
  627. */
  628. ENGINE_CALLBACK_NOTE_ON = 13,
  629. /*!
  630. * A note has been released.
  631. * @a pluginId Plugin Id
  632. * @a value1 Channel
  633. * @a value2 Note
  634. */
  635. ENGINE_CALLBACK_NOTE_OFF = 14,
  636. /*!
  637. * A plugin needs update.
  638. * @a pluginId Plugin Id
  639. */
  640. ENGINE_CALLBACK_UPDATE = 15,
  641. /*!
  642. * A plugin's data/information has changed.
  643. * @a pluginId Plugin Id
  644. */
  645. ENGINE_CALLBACK_RELOAD_INFO = 16,
  646. /*!
  647. * A plugin's parameters have changed.
  648. * @a pluginId Plugin Id
  649. */
  650. ENGINE_CALLBACK_RELOAD_PARAMETERS = 17,
  651. /*!
  652. * A plugin's programs have changed.
  653. * @a pluginId Plugin Id
  654. */
  655. ENGINE_CALLBACK_RELOAD_PROGRAMS = 18,
  656. /*!
  657. * A plugin state has changed.
  658. * @a pluginId Plugin Id
  659. */
  660. ENGINE_CALLBACK_RELOAD_ALL = 19,
  661. #ifndef BUILD_BRIDGE
  662. /*!
  663. * A patchbay client has been added.
  664. * @a pluginId Client Id
  665. * @a value1 Client icon
  666. * @a value2 Plugin Id (-1 if not a plugin)
  667. * @a valueStr Client name
  668. * @see PatchbayIcon
  669. */
  670. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20,
  671. /*!
  672. * A patchbay client has been removed.
  673. * @a pluginId Client Id
  674. */
  675. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21,
  676. /*!
  677. * A patchbay client has been renamed.
  678. * @a pluginId Client Id
  679. * @a valueStr New client name
  680. */
  681. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22,
  682. /*!
  683. * A patchbay client data has changed.
  684. * @a pluginId Client Id
  685. * @a value1 New icon
  686. * @a value2 New plugin Id (-1 if not a plugin)
  687. * @see PatchbayIcon
  688. */
  689. ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23,
  690. /*!
  691. * A patchbay port has been added.
  692. * @a pluginId Client Id
  693. * @a value1 Port Id
  694. * @a value2 Port hints
  695. * @a valueStr Port name
  696. * @see PatchbayPortHints
  697. */
  698. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24,
  699. /*!
  700. * A patchbay port has been removed.
  701. * @a pluginId Client Id
  702. * @a value1 Port Id
  703. */
  704. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25,
  705. /*!
  706. * A patchbay port has been renamed.
  707. * @a pluginId Client Id
  708. * @a value1 Port Id
  709. * @a valueStr New port name
  710. */
  711. ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 26,
  712. /*!
  713. * A patchbay connection has been added.
  714. * @a pluginId Connection Id
  715. * @a valueStr Out group and port plus in group and port, in "og:op:ig:ip" syntax.
  716. */
  717. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27,
  718. /*!
  719. * A patchbay connection has been removed.
  720. * @a pluginId Connection Id
  721. */
  722. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28,
  723. #endif
  724. /*!
  725. * Engine started.
  726. * @a value1 Process mode
  727. * @a value2 Transport mode
  728. * @a valuestr Engine driver
  729. * @see EngineProcessMode
  730. * @see EngineTransportMode
  731. */
  732. ENGINE_CALLBACK_ENGINE_STARTED = 29,
  733. /*!
  734. * Engine stopped.
  735. */
  736. ENGINE_CALLBACK_ENGINE_STOPPED = 30,
  737. /*!
  738. * Engine process mode has changed.
  739. * @a value1 New process mode
  740. * @see EngineProcessMode
  741. */
  742. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31,
  743. /*!
  744. * Engine transport mode has changed.
  745. * @a value1 New transport mode
  746. * @see EngineTransportMode
  747. */
  748. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32,
  749. /*!
  750. * Engine buffer-size changed.
  751. * @a value1 New buffer size
  752. */
  753. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33,
  754. /*!
  755. * Engine sample-rate changed.
  756. * @a value3 New sample rate
  757. */
  758. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34,
  759. /*!
  760. * Project has finished loading.
  761. */
  762. ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 35,
  763. /*!
  764. * NSM callback.
  765. * (Work in progress, values are not defined yet)
  766. */
  767. ENGINE_CALLBACK_NSM = 36,
  768. /*!
  769. * Idle frontend.
  770. * This is used by the engine during long operations that might block the frontend,
  771. * giving it the possibility to idle while the operation is still in place.
  772. */
  773. ENGINE_CALLBACK_IDLE = 37,
  774. /*!
  775. * Show a message as information.
  776. * @a valueStr The message
  777. */
  778. ENGINE_CALLBACK_INFO = 38,
  779. /*!
  780. * Show a message as an error.
  781. * @a valueStr The message
  782. */
  783. ENGINE_CALLBACK_ERROR = 39,
  784. /*!
  785. * The engine has crashed or malfunctioned and will no longer work.
  786. */
  787. ENGINE_CALLBACK_QUIT = 40
  788. } EngineCallbackOpcode;
  789. /* ------------------------------------------------------------------------------------------------------------
  790. * Engine Option */
  791. /*!
  792. * Engine options.
  793. * @see CarlaEngine::getOptions(), CarlaEngine::setOption() and carla_set_engine_option()
  794. */
  795. typedef enum {
  796. /*!
  797. * Debug.
  798. * This option is undefined and used only for testing purposes.
  799. */
  800. ENGINE_OPTION_DEBUG = 0,
  801. /*!
  802. * Set the engine processing mode.
  803. * Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_PATCHBAY for all other OSes.
  804. * @see EngineProcessMode
  805. */
  806. ENGINE_OPTION_PROCESS_MODE = 1,
  807. /*!
  808. * Set the engine transport mode.
  809. * Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  810. * @see EngineTransportMode
  811. */
  812. ENGINE_OPTION_TRANSPORT_MODE = 2,
  813. /*!
  814. * Force mono plugins as stereo, by running 2 instances at the same time.
  815. * Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  816. * @note Not supported by all plugins
  817. * @see PLUGIN_OPTION_FORCE_STEREO
  818. */
  819. ENGINE_OPTION_FORCE_STEREO = 3,
  820. /*!
  821. * Use plugin bridges whenever possible.
  822. * Default is no, EXPERIMENTAL.
  823. */
  824. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4,
  825. /*!
  826. * Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  827. * Default is yes.
  828. */
  829. ENGINE_OPTION_PREFER_UI_BRIDGES = 5,
  830. /*!
  831. * Make custom plugin UIs always-on-top.
  832. * Default is yes.
  833. */
  834. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6,
  835. /*!
  836. * Maximum number of parameters allowed.
  837. * Default is MAX_DEFAULT_PARAMETERS.
  838. */
  839. ENGINE_OPTION_MAX_PARAMETERS = 7,
  840. /*!
  841. * Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  842. * Default is 4000 (4 seconds).
  843. */
  844. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8,
  845. /*!
  846. * Number of audio periods.
  847. * Default is 2.
  848. */
  849. ENGINE_OPTION_AUDIO_NUM_PERIODS = 9,
  850. /*!
  851. * Audio buffer size.
  852. * Default is 512.
  853. */
  854. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10,
  855. /*!
  856. * Audio sample rate.
  857. * Default is 44100.
  858. */
  859. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11,
  860. /*!
  861. * Audio device (within a driver).
  862. * Default unset.
  863. */
  864. ENGINE_OPTION_AUDIO_DEVICE = 12,
  865. /*!
  866. * Set path used for a specific plugin type.
  867. * Uses value as the plugin format, valueStr as actual path.
  868. * @see PluginType
  869. */
  870. ENGINE_OPTION_PLUGIN_PATH = 13,
  871. /*!
  872. * Set path to the binary files.
  873. * Default unset.
  874. * @note Must be set for plugin and UI bridges to work
  875. */
  876. ENGINE_OPTION_PATH_BINARIES = 14,
  877. /*!
  878. * Set path to the resource files.
  879. * Default unset.
  880. * @note Must be set for some internal plugins to work
  881. */
  882. ENGINE_OPTION_PATH_RESOURCES = 15,
  883. /*!
  884. * Prevent bad plugin and UI behaviour.
  885. * @note: Linux only
  886. */
  887. ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 16,
  888. /*!
  889. * Set frontend winId, used to define as parent window for plugin UIs.
  890. */
  891. ENGINE_OPTION_FRONTEND_WIN_ID = 17,
  892. /*!
  893. * Set path to wine executable.
  894. */
  895. ENGINE_OPTION_WINE_EXECUTABLE = 18,
  896. /*!
  897. * Enable automatic wineprefix detection.
  898. */
  899. ENGINE_OPTION_WINE_AUTO_PREFIX = 19,
  900. /*!
  901. * Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
  902. */
  903. ENGINE_OPTION_WINE_FALLBACK_PREFIX = 20,
  904. /*!
  905. * Enable realtime priority for Wine application and server threads.
  906. */
  907. ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 21,
  908. /*!
  909. * Base realtime priority for Wine threads.
  910. */
  911. ENGINE_OPTION_WINE_BASE_RT_PRIO = 22,
  912. /*!
  913. * Wine server realtime priority.
  914. */
  915. ENGINE_OPTION_WINE_SERVER_RT_PRIO = 23,
  916. /*!
  917. * Capture console output into debug callbacks.
  918. */
  919. ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 24
  920. } EngineOption;
  921. /* ------------------------------------------------------------------------------------------------------------
  922. * Engine Process Mode */
  923. /*!
  924. * Engine process mode.
  925. * @see ENGINE_OPTION_PROCESS_MODE
  926. */
  927. typedef enum {
  928. /*!
  929. * Single client mode.
  930. * Inputs and outputs are added dynamically as needed by plugins.
  931. */
  932. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0,
  933. /*!
  934. * Multiple client mode.
  935. * It has 1 master client + 1 client per plugin.
  936. */
  937. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1,
  938. /*!
  939. * Single client, 'rack' mode.
  940. * Processes plugins in order of Id, with forced stereo always on.
  941. */
  942. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2,
  943. /*!
  944. * Single client, 'patchbay' mode.
  945. */
  946. ENGINE_PROCESS_MODE_PATCHBAY = 3,
  947. /*!
  948. * Special mode, used in plugin-bridges only.
  949. */
  950. ENGINE_PROCESS_MODE_BRIDGE = 4
  951. } EngineProcessMode;
  952. /* ------------------------------------------------------------------------------------------------------------
  953. * Engine Transport Mode */
  954. /*!
  955. * Engine transport mode.
  956. * @see ENGINE_OPTION_TRANSPORT_MODE
  957. */
  958. typedef enum {
  959. /*!
  960. * Internal transport mode.
  961. */
  962. ENGINE_TRANSPORT_MODE_INTERNAL = 0,
  963. /*!
  964. * Transport from JACK.
  965. * Only available if driver name is "JACK".
  966. */
  967. ENGINE_TRANSPORT_MODE_JACK = 1,
  968. /*!
  969. * Transport from host, used when Carla is a plugin.
  970. */
  971. ENGINE_TRANSPORT_MODE_PLUGIN = 2,
  972. /*!
  973. * Special mode, used in plugin-bridges only.
  974. */
  975. ENGINE_TRANSPORT_MODE_BRIDGE = 3
  976. } EngineTransportMode;
  977. /* ------------------------------------------------------------------------------------------------------------
  978. * File Callback Opcode */
  979. /*!
  980. * File callback opcodes.
  981. * Front-ends must always block-wait for user input.
  982. * @see FileCallbackFunc, CarlaEngine::setFileCallback() and carla_set_file_callback()
  983. */
  984. typedef enum {
  985. /*!
  986. * Debug.
  987. * This opcode is undefined and used only for testing purposes.
  988. */
  989. FILE_CALLBACK_DEBUG = 0,
  990. /*!
  991. * Open file or folder.
  992. */
  993. FILE_CALLBACK_OPEN = 1,
  994. /*!
  995. * Save file or folder.
  996. */
  997. FILE_CALLBACK_SAVE = 2
  998. } FileCallbackOpcode;
  999. /* ------------------------------------------------------------------------------------------------------------
  1000. * Patchbay Icon */
  1001. /*!
  1002. * The icon of a patchbay client/group.
  1003. */
  1004. enum PatchbayIcon {
  1005. /*!
  1006. * Generic application icon.
  1007. * Used for all non-plugin clients that don't have a specific icon.
  1008. */
  1009. PATCHBAY_ICON_APPLICATION = 0,
  1010. /*!
  1011. * Plugin icon.
  1012. * Used for all plugin clients that don't have a specific icon.
  1013. */
  1014. PATCHBAY_ICON_PLUGIN = 1,
  1015. /*!
  1016. * Hardware icon.
  1017. * Used for hardware (audio or MIDI) clients.
  1018. */
  1019. PATCHBAY_ICON_HARDWARE = 2,
  1020. /*!
  1021. * Carla icon.
  1022. * Used for the main app.
  1023. */
  1024. PATCHBAY_ICON_CARLA = 3,
  1025. /*!
  1026. * DISTRHO icon.
  1027. * Used for DISTRHO based plugins.
  1028. */
  1029. PATCHBAY_ICON_DISTRHO = 4,
  1030. /*!
  1031. * File icon.
  1032. * Used for file type plugins (like GIG and SF2).
  1033. */
  1034. PATCHBAY_ICON_FILE = 5
  1035. };
  1036. /* ------------------------------------------------------------------------------------------------------------
  1037. * Carla Backend API (C stuff) */
  1038. /*!
  1039. * Engine callback function.
  1040. * Front-ends must never block indefinitely during a callback.
  1041. * @see EngineCallbackOpcode, CarlaEngine::setCallback() and carla_set_engine_callback()
  1042. */
  1043. typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackOpcode action, uint pluginId, int value1, int value2, float value3, const char* valueStr);
  1044. /*!
  1045. * File callback function.
  1046. * @see FileCallbackOpcode
  1047. */
  1048. typedef const char* (*FileCallbackFunc)(void* ptr, FileCallbackOpcode action, bool isDir, const char* title, const char* filter);
  1049. /*!
  1050. * Parameter data.
  1051. */
  1052. typedef struct {
  1053. /*!
  1054. * This parameter type.
  1055. */
  1056. ParameterType type;
  1057. /*!
  1058. * This parameter hints.
  1059. * @see ParameterHints
  1060. */
  1061. uint hints;
  1062. /*!
  1063. * Index as seen by Carla.
  1064. */
  1065. int32_t index;
  1066. /*!
  1067. * Real index as seen by plugins.
  1068. */
  1069. int32_t rindex;
  1070. /*!
  1071. * Currently mapped MIDI CC.
  1072. * A value lower than 0 means invalid or unused.
  1073. * Maximum allowed value is 119 (0x77).
  1074. */
  1075. int16_t midiCC;
  1076. /*!
  1077. * Currently mapped MIDI channel.
  1078. * Counts from 0 to 15.
  1079. */
  1080. uint8_t midiChannel;
  1081. } ParameterData;
  1082. /*!
  1083. * Parameter ranges.
  1084. */
  1085. typedef struct {
  1086. /*!
  1087. * Default value.
  1088. */
  1089. float def;
  1090. /*!
  1091. * Minimum value.
  1092. */
  1093. float min;
  1094. /*!
  1095. * Maximum value.
  1096. */
  1097. float max;
  1098. /*!
  1099. * Regular, single step value.
  1100. */
  1101. float step;
  1102. /*!
  1103. * Small step value.
  1104. */
  1105. float stepSmall;
  1106. /*!
  1107. * Large step value.
  1108. */
  1109. float stepLarge;
  1110. #ifdef __cplusplus
  1111. /*!
  1112. * Fix the default value within range.
  1113. */
  1114. void fixDefault() noexcept
  1115. {
  1116. fixValue(def);
  1117. }
  1118. /*!
  1119. * Fix a value within range.
  1120. */
  1121. void fixValue(float& value) const noexcept
  1122. {
  1123. if (value < min)
  1124. value = min;
  1125. else if (value > max)
  1126. value = max;
  1127. }
  1128. /*!
  1129. * Get a fixed value within range.
  1130. */
  1131. const float& getFixedValue(const float& value) const noexcept
  1132. {
  1133. if (value <= min)
  1134. return min;
  1135. if (value >= max)
  1136. return max;
  1137. return value;
  1138. }
  1139. /*!
  1140. * Get a value normalized to 0.0<->1.0.
  1141. */
  1142. float getNormalizedValue(const float& value) const noexcept
  1143. {
  1144. const float normValue((value - min) / (max - min));
  1145. if (normValue <= 0.0f)
  1146. return 0.0f;
  1147. if (normValue >= 1.0f)
  1148. return 1.0f;
  1149. return normValue;
  1150. }
  1151. /*!
  1152. * Get a value normalized to 0.0<->1.0, fixed within range.
  1153. */
  1154. float getFixedAndNormalizedValue(const float& value) const noexcept
  1155. {
  1156. if (value <= min)
  1157. return 0.0f;
  1158. if (value >= max)
  1159. return 1.0f;
  1160. const float normValue((value - min) / (max - min));
  1161. if (normValue <= 0.0f)
  1162. return 0.0f;
  1163. if (normValue >= 1.0f)
  1164. return 1.0f;
  1165. return normValue;
  1166. }
  1167. /*!
  1168. * Get a proper value previously normalized to 0.0<->1.0.
  1169. */
  1170. float getUnnormalizedValue(const float& value) const noexcept
  1171. {
  1172. if (value <= 0.0f)
  1173. return min;
  1174. if (value >= 1.0f)
  1175. return max;
  1176. return value * (max - min) + min;
  1177. }
  1178. /*!
  1179. * Get a logarithmic value previously normalized to 0.0<->1.0.
  1180. */
  1181. float getUnnormalizedLogValue(const float& value) const noexcept
  1182. {
  1183. if (value <= 0.0f)
  1184. return min;
  1185. if (value >= 1.0f)
  1186. return max;
  1187. return min * std::pow(max/min, value);
  1188. }
  1189. #endif /* __cplusplus */
  1190. } ParameterRanges;
  1191. /*!
  1192. * MIDI Program data.
  1193. */
  1194. typedef struct {
  1195. /*!
  1196. * MIDI bank.
  1197. */
  1198. uint32_t bank;
  1199. /*!
  1200. * MIDI program.
  1201. */
  1202. uint32_t program;
  1203. /*!
  1204. * MIDI program name.
  1205. */
  1206. const char* name;
  1207. } MidiProgramData;
  1208. /*!
  1209. * Custom data, used for saving key:value 'dictionaries'.
  1210. */
  1211. typedef struct {
  1212. /*!
  1213. * Value type, in URI form.
  1214. * @see CustomDataTypes
  1215. */
  1216. const char* type;
  1217. /*!
  1218. * Key.
  1219. * @see CustomDataKeys
  1220. */
  1221. const char* key;
  1222. /*!
  1223. * Value.
  1224. */
  1225. const char* value;
  1226. #ifdef __cplusplus
  1227. /*!
  1228. * Check if valid.
  1229. */
  1230. bool isValid() const noexcept
  1231. {
  1232. if (type == nullptr || type[0] == '\0') return false;
  1233. if (key == nullptr || key [0] == '\0') return false;
  1234. if (value == nullptr) return false;
  1235. return true;
  1236. }
  1237. #endif /* __cplusplus */
  1238. } CustomData;
  1239. /*!
  1240. * Engine driver device information.
  1241. */
  1242. typedef struct {
  1243. /*!
  1244. * This driver device hints.
  1245. * @see EngineDriverHints
  1246. */
  1247. uint hints;
  1248. /*!
  1249. * Available buffer sizes.
  1250. * Terminated with 0.
  1251. */
  1252. const uint32_t* bufferSizes;
  1253. /*!
  1254. * Available sample rates.
  1255. * Terminated with 0.0.
  1256. */
  1257. const double* sampleRates;
  1258. } EngineDriverDeviceInfo;
  1259. /** @} */
  1260. #ifdef __cplusplus
  1261. /* Forward declarations of commonly used Carla classes */
  1262. class CarlaEngine;
  1263. class CarlaEngineClient;
  1264. class CarlaPlugin;
  1265. /* End namespace */
  1266. CARLA_BACKEND_END_NAMESPACE
  1267. #endif
  1268. #endif /* CARLA_BACKEND_H_INCLUDED */