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.

1674 lines
37KB

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