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

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