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.

1445 lines
31KB

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