DISTRHO Plugin Framework
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.

965 lines
29KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifdef DOXYGEN
  17. #include "src/DistrhoDefines.h"
  18. START_NAMESPACE_DISTRHO
  19. /* ------------------------------------------------------------------------------------------------------------
  20. * Intro */
  21. /**
  22. @mainpage DISTRHO %Plugin Framework
  23. DISTRHO %Plugin Framework (or @b DPF for short)
  24. is a plugin framework designed to make development of new plugins an easy and enjoyable task.@n
  25. It allows developers to create plugins with custom UIs using a simple C++ API.@n
  26. The framework facilitates exporting various different plugin formats from the same code-base.
  27. DPF can build for LADSPA, DSSI, LV2, VST2, VST3 and CLAP formats.@n
  28. A JACK/Standalone mode is also available, allowing you to quickly test plugins.
  29. @section Macros
  30. You start by creating a "DistrhoPluginInfo.h" file describing the plugin via macros, see @ref PluginMacros.@n
  31. This file is included during compilation of the main DPF code to select which features to activate for each plugin format.
  32. For example, a plugin (with %UI) that use states will require LV2 hosts to support Atom and Worker extensions for
  33. message passing from the %UI to the (DSP) plugin.@n
  34. If your plugin does not make use of states, the Worker extension is not set as a required feature.
  35. @section Plugin
  36. The next step is to create your plugin code by subclassing DPF's Plugin class.@n
  37. You need to pass the number of parameters in the constructor and also the number of programs and states, if any.
  38. Do note all of DPF code is within its own C++ namespace (@b DISTRHO for DSP/plugin stuff, @b DGL for UI stuff).@n
  39. You can use @ref START_NAMESPACE_DISTRHO / @ref END_NAMESPACE_DISTRHO combo around your code, or globally set @ref USE_NAMESPACE_DISTRHO.@n
  40. These are defined as compiler macros so that you can override the namespace name during build. When in doubt, just follow the examples.
  41. @section Examples
  42. Let's begin with some examples.@n
  43. Here is one of a stereo audio plugin that simply mutes the host output:
  44. @code
  45. /* DPF plugin include */
  46. #include "DistrhoPlugin.hpp"
  47. /* Make DPF related classes available for us to use without any extra namespace references */
  48. USE_NAMESPACE_DISTRHO;
  49. /**
  50. Our custom plugin class.
  51. Subclassing `Plugin` from DPF is how this all works.
  52. By default, only information-related functions and `run` are pure virtual (that is, must be reimplemented).
  53. When enabling certain features (such as programs or states, more on that below), a few extra functions also need to be reimplemented.
  54. */
  55. class MutePlugin : public Plugin
  56. {
  57. public:
  58. /**
  59. Plugin class constructor.
  60. */
  61. MutePlugin()
  62. : Plugin(0, 0, 0) // 0 parameters, 0 programs and 0 states
  63. {
  64. }
  65. protected:
  66. /* ----------------------------------------------------------------------------------------
  67. * Information */
  68. /**
  69. Get the plugin label.
  70. This label is a short restricted name consisting of only _, a-z, A-Z and 0-9 characters.
  71. */
  72. const char* getLabel() const override
  73. {
  74. return "Mute";
  75. }
  76. /**
  77. Get the plugin author/maker.
  78. */
  79. const char* getMaker() const override
  80. {
  81. return "DPF";
  82. }
  83. /**
  84. Get the plugin license name (a single line of text).
  85. For commercial plugins this should return some short copyright information.
  86. */
  87. const char* getLicense() const override
  88. {
  89. return "MIT";
  90. }
  91. /**
  92. Get the plugin version, in hexadecimal.
  93. */
  94. uint32_t getVersion() const override
  95. {
  96. return d_version(1, 0, 0);
  97. }
  98. /**
  99. Get the plugin unique Id.
  100. This value is used by LADSPA, DSSI, VST2 and VST3 plugin formats.
  101. */
  102. int64_t getUniqueId() const override
  103. {
  104. return d_cconst('M', 'u', 't', 'e');
  105. }
  106. /* ----------------------------------------------------------------------------------------
  107. * Audio/MIDI Processing */
  108. /**
  109. Run/process function for plugins without MIDI input.
  110. */
  111. void run(const float**, float** outputs, uint32_t frames) override
  112. {
  113. // get the left and right audio outputs
  114. float* const outL = outputs[0];
  115. float* const outR = outputs[1];
  116. // mute audio
  117. std::memset(outL, 0, sizeof(float)*frames);
  118. std::memset(outR, 0, sizeof(float)*frames);
  119. }
  120. };
  121. /**
  122. Create an instance of the Plugin class.
  123. This is the entry point for DPF plugins.
  124. DPF will call this to either create an instance of your plugin for the host or to fetch some initial information for internal caching.
  125. */
  126. Plugin* createPlugin()
  127. {
  128. return new MutePlugin();
  129. }
  130. @endcode
  131. See the Plugin class for more information.
  132. @section Parameters
  133. A plugin is nothing without parameters.@n
  134. In DPF parameters can be inputs or outputs.@n
  135. They have hints to describe how they behave plus a name and a symbol identifying them.@n
  136. Parameters also have 'ranges' - a minimum, maximum and default value.
  137. Input parameters are by default "read-only": the plugin can read them but not change them.
  138. (there are exceptions and possibly a request to the host to change values, more on that below)@n
  139. It's the host responsibility to save, restore and set input parameters.
  140. Output parameters can be changed at anytime by the plugin.@n
  141. The host will simply read their values and never change them.
  142. Here's an example of an audio plugin that has 1 input parameter:
  143. @code
  144. class GainPlugin : public Plugin
  145. {
  146. public:
  147. /**
  148. Plugin class constructor.
  149. You must set all parameter values to their defaults, matching ParameterRanges::def.
  150. */
  151. GainPlugin()
  152. : Plugin(1, 0, 0), // 1 parameter, 0 programs and 0 states
  153. fGain(1.0f)
  154. {
  155. }
  156. protected:
  157. /* ----------------------------------------------------------------------------------------
  158. * Information */
  159. const char* getLabel() const override
  160. {
  161. return "Gain";
  162. }
  163. const char* getMaker() const override
  164. {
  165. return "DPF";
  166. }
  167. const char* getLicense() const override
  168. {
  169. return "MIT";
  170. }
  171. uint32_t getVersion() const override
  172. {
  173. return d_version(1, 0, 0);
  174. }
  175. int64_t getUniqueId() const override
  176. {
  177. return d_cconst('G', 'a', 'i', 'n');
  178. }
  179. /* ----------------------------------------------------------------------------------------
  180. * Init */
  181. /**
  182. Initialize a parameter.
  183. This function will be called once, shortly after the plugin is created.
  184. */
  185. void initParameter(uint32_t index, Parameter& parameter) override
  186. {
  187. // we only have one parameter so we can skip checking the index
  188. parameter.hints = kParameterIsAutomatable;
  189. parameter.name = "Gain";
  190. parameter.symbol = "gain";
  191. parameter.ranges.min = 0.0f;
  192. parameter.ranges.max = 2.0f;
  193. parameter.ranges.def = 1.0f;
  194. }
  195. /* ----------------------------------------------------------------------------------------
  196. * Internal data */
  197. /**
  198. Get the current value of a parameter.
  199. */
  200. float getParameterValue(uint32_t index) const override
  201. {
  202. // same as before, ignore index check
  203. return fGain;
  204. }
  205. /**
  206. Change a parameter value.
  207. */
  208. void setParameterValue(uint32_t index, float value) override
  209. {
  210. // same as before, ignore index check
  211. fGain = value;
  212. }
  213. /* ----------------------------------------------------------------------------------------
  214. * Audio/MIDI Processing */
  215. void run(const float**, float** outputs, uint32_t frames) override
  216. {
  217. // get the mono input and output
  218. const float* const in = inputs[0];
  219. /* */ float* const out = outputs[0];
  220. // apply gain against all samples
  221. for (uint32_t i=0; i < frames; ++i)
  222. out[i] = in[i] * fGain;
  223. }
  224. private:
  225. float fGain;
  226. };
  227. @endcode
  228. See the Parameter struct for more information about parameters.
  229. @section Programs
  230. Programs in DPF refer to plugin-side presets (usually called "factory presets").@n
  231. This is meant as an initial set of presets provided by plugin authors included in the actual plugin.
  232. To use programs you must first enable them by setting @ref DISTRHO_PLUGIN_WANT_PROGRAMS to 1 in your DistrhoPluginInfo.h file.@n
  233. When enabled you'll need to override 2 new function in your plugin code,
  234. Plugin::initProgramName(uint32_t, String&) and Plugin::loadProgram(uint32_t).
  235. Here's an example of a plugin with a "default" program:
  236. @code
  237. class PluginWithPresets : public Plugin
  238. {
  239. public:
  240. PluginWithPresets()
  241. : Plugin(2, 1, 0), // 2 parameters, 1 program and 0 states
  242. fGainL(1.0f),
  243. fGainR(1.0f),
  244. {
  245. }
  246. protected:
  247. /* ----------------------------------------------------------------------------------------
  248. * Information */
  249. const char* getLabel() const override
  250. {
  251. return "Prog";
  252. }
  253. const char* getMaker() const override
  254. {
  255. return "DPF";
  256. }
  257. const char* getLicense() const override
  258. {
  259. return "MIT";
  260. }
  261. uint32_t getVersion() const override
  262. {
  263. return d_version(1, 0, 0);
  264. }
  265. int64_t getUniqueId() const override
  266. {
  267. return d_cconst('P', 'r', 'o', 'g');
  268. }
  269. /* ----------------------------------------------------------------------------------------
  270. * Init */
  271. /**
  272. Initialize a parameter.
  273. This function will be called once, shortly after the plugin is created.
  274. */
  275. void initParameter(uint32_t index, Parameter& parameter) override
  276. {
  277. parameter.hints = kParameterIsAutomatable;
  278. parameter.ranges.min = 0.0f;
  279. parameter.ranges.max = 2.0f;
  280. parameter.ranges.def = 1.0f;
  281. switch (index)
  282. {
  283. case 0:
  284. parameter.name = "Gain Right";
  285. parameter.symbol = "gainR";
  286. break;
  287. case 1:
  288. parameter.name = "Gain Left";
  289. parameter.symbol = "gainL";
  290. break;
  291. }
  292. }
  293. /**
  294. Set the name of the program @a index.
  295. This function will be called once, shortly after the plugin is created.
  296. */
  297. void initProgramName(uint32_t index, String& programName)
  298. {
  299. // we only have one program so we can skip checking the index
  300. programName = "Default";
  301. }
  302. /* ----------------------------------------------------------------------------------------
  303. * Internal data */
  304. /**
  305. Get the current value of a parameter.
  306. */
  307. float getParameterValue(uint32_t index) const override
  308. {
  309. switch (index)
  310. {
  311. case 0:
  312. return fGainL;
  313. case 1:
  314. return fGainR;
  315. default:
  316. return 0.f;
  317. }
  318. }
  319. /**
  320. Change a parameter value.
  321. */
  322. void setParameterValue(uint32_t index, float value) override
  323. {
  324. switch (index)
  325. {
  326. case 0:
  327. fGainL = value;
  328. break;
  329. case 1:
  330. fGainR = value;
  331. break;
  332. }
  333. }
  334. /**
  335. Load a program.
  336. */
  337. void loadProgram(uint32_t index)
  338. {
  339. // same as before, ignore index check
  340. fGainL = 1.0f;
  341. fGainR = 1.0f;
  342. }
  343. /* ----------------------------------------------------------------------------------------
  344. * Audio/MIDI Processing */
  345. void run(const float**, float** outputs, uint32_t frames) override
  346. {
  347. // get the left and right audio buffers
  348. const float* const inL = inputs[0];
  349. const float* const inR = inputs[0];
  350. /* */ float* const outL = outputs[0];
  351. /* */ float* const outR = outputs[0];
  352. // apply gain against all samples
  353. for (uint32_t i=0; i < frames; ++i)
  354. {
  355. outL[i] = inL[i] * fGainL;
  356. outR[i] = inR[i] * fGainR;
  357. }
  358. }
  359. private:
  360. float fGainL, fGainR;
  361. };
  362. @endcode
  363. This is a work-in-progress documentation page. States, MIDI, Latency, Time-Position and UI are still TODO.
  364. */
  365. #if 0
  366. @section States
  367. describe them
  368. @section MIDI
  369. describe them
  370. @section Latency
  371. describe it
  372. @section Time-Position
  373. describe it
  374. @section UI
  375. describe them
  376. #endif
  377. /* ------------------------------------------------------------------------------------------------------------
  378. * Plugin Macros */
  379. /**
  380. @defgroup PluginMacros Plugin Macros
  381. C Macros that describe your plugin. (defined in the "DistrhoPluginInfo.h" file)
  382. With these macros you can tell the host what features your plugin requires.@n
  383. Depending on which macros you enable, new functions will be available to call and/or override.
  384. All values are either integer or strings.@n
  385. For boolean-like values 1 means 'on' and 0 means 'off'.
  386. The values defined in this group are for documentation purposes only.@n
  387. All macros are disabled by default.
  388. Only 4 macros are required, they are:
  389. - @ref DISTRHO_PLUGIN_NAME
  390. - @ref DISTRHO_PLUGIN_NUM_INPUTS
  391. - @ref DISTRHO_PLUGIN_NUM_OUTPUTS
  392. - @ref DISTRHO_PLUGIN_URI
  393. Additionally, @ref DISTRHO_PLUGIN_CLAP_ID is required if building CLAP plugins.
  394. @{
  395. */
  396. /**
  397. The plugin name.@n
  398. This is used to identify your plugin before a Plugin instance can be created.
  399. @note This macro is required.
  400. */
  401. #define DISTRHO_PLUGIN_NAME "Plugin Name"
  402. /**
  403. Number of audio inputs the plugin has.
  404. @note This macro is required.
  405. */
  406. #define DISTRHO_PLUGIN_NUM_INPUTS 2
  407. /**
  408. Number of audio outputs the plugin has.
  409. @note This macro is required.
  410. */
  411. #define DISTRHO_PLUGIN_NUM_OUTPUTS 2
  412. /**
  413. The plugin URI when exporting in LV2 format.
  414. @note This macro is required.
  415. */
  416. #define DISTRHO_PLUGIN_URI "urn:distrho:name"
  417. /**
  418. Whether the plugin has a custom %UI.
  419. @see DISTRHO_UI_USE_NANOVG
  420. @see UI
  421. */
  422. #define DISTRHO_PLUGIN_HAS_UI 1
  423. /**
  424. Whether the plugin processing is realtime-safe.@n
  425. TODO - list rtsafe requirements
  426. */
  427. #define DISTRHO_PLUGIN_IS_RT_SAFE 1
  428. /**
  429. Whether the plugin is a synth.@n
  430. @ref DISTRHO_PLUGIN_WANT_MIDI_INPUT is automatically enabled when this is too.
  431. @see DISTRHO_PLUGIN_WANT_MIDI_INPUT
  432. */
  433. #define DISTRHO_PLUGIN_IS_SYNTH 1
  434. /**
  435. Request the minimum buffer size for the input and output event ports.@n
  436. Currently only used in LV2, with a default value of 2048 if unset.
  437. */
  438. #define DISTRHO_PLUGIN_MINIMUM_BUFFER_SIZE 2048
  439. /**
  440. Whether the plugin has an LV2 modgui.
  441. This will simply add a "rdfs:seeAlso <modgui.ttl>" on the LV2 manifest.@n
  442. It is up to you to create this file.
  443. */
  444. #define DISTRHO_PLUGIN_USES_MODGUI 0
  445. /**
  446. Enable direct access between the %UI and plugin code.
  447. @see UI::getPluginInstancePointer()
  448. @note DO NOT USE THIS UNLESS STRICTLY NECESSARY!!
  449. Try to avoid it at all costs!
  450. */
  451. #define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
  452. /**
  453. Whether the plugin introduces latency during audio or midi processing.
  454. @see Plugin::setLatency(uint32_t)
  455. */
  456. #define DISTRHO_PLUGIN_WANT_LATENCY 1
  457. /**
  458. Whether the plugin wants MIDI input.@n
  459. This is automatically enabled if @ref DISTRHO_PLUGIN_IS_SYNTH is true.
  460. */
  461. #define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1
  462. /**
  463. Whether the plugin wants MIDI output.
  464. @see Plugin::writeMidiEvent(const MidiEvent&)
  465. */
  466. #define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1
  467. /**
  468. Whether the plugin wants to change its own parameter inputs.@n
  469. Not all hosts or plugin formats support this,
  470. so Plugin::canRequestParameterValueChanges() can be used to query support at runtime.
  471. @see Plugin::requestParameterValueChange(uint32_t, float)
  472. */
  473. #define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 1
  474. /**
  475. Whether the plugin provides its own internal programs.
  476. @see Plugin::initProgramName(uint32_t, String&)
  477. @see Plugin::loadProgram(uint32_t)
  478. */
  479. #define DISTRHO_PLUGIN_WANT_PROGRAMS 1
  480. /**
  481. Whether the plugin uses internal non-parameter data.
  482. @see Plugin::initState(uint32_t, String&, String&)
  483. @see Plugin::setState(const char*, const char*)
  484. */
  485. #define DISTRHO_PLUGIN_WANT_STATE 1
  486. /**
  487. Whether the plugin implements the full state API.
  488. When this macro is enabled, the plugin must implement a new getState(const char* key) function, which the host calls when saving its session/project.
  489. This is useful for plugins that have custom internal values not exposed to the host as key-value state pairs or parameters.
  490. Most simple effects and synths will not need this.
  491. @note this macro is automatically enabled if a plugin has programs and state, as the key-value state pairs need to be updated when the current program changes.
  492. @see Plugin::getState(const char*)
  493. */
  494. #define DISTRHO_PLUGIN_WANT_FULL_STATE 1
  495. /**
  496. Whether the plugin wants time position information from the host.
  497. @see Plugin::getTimePosition()
  498. */
  499. #define DISTRHO_PLUGIN_WANT_TIMEPOS 1
  500. /**
  501. Whether the %UI uses a custom toolkit implementation based on OpenGL.@n
  502. When enabled, the macros @ref DISTRHO_UI_CUSTOM_INCLUDE_PATH and @ref DISTRHO_UI_CUSTOM_WIDGET_TYPE are required.
  503. */
  504. #define DISTRHO_UI_USE_CUSTOM 1
  505. /**
  506. The include path to the header file used by the custom toolkit implementation.
  507. This path must be relative to dpf/distrho/DistrhoUI.hpp
  508. @see DISTRHO_UI_USE_CUSTOM
  509. */
  510. #define DISTRHO_UI_CUSTOM_INCLUDE_PATH
  511. /**
  512. The top-level-widget typedef to use for the custom toolkit.
  513. This widget class MUST be a subclass of DGL TopLevelWindow class.
  514. It is recommended that you keep this widget class inside the DGL namespace,
  515. and define widget type as e.g. DGL_NAMESPACE::MyCustomTopLevelWidget.
  516. @see DISTRHO_UI_USE_CUSTOM
  517. */
  518. #define DISTRHO_UI_CUSTOM_WIDGET_TYPE
  519. /**
  520. Default UI width to use when creating initial and temporary windows.@n
  521. Setting this macro allows to skip a temporary UI from being created in certain VST2 and VST3 hosts.
  522. (which would normally be done for knowing the UI size before host creates a window for it)
  523. Value must match 1x scale factor.
  524. When this macro is defined, the companion DISTRHO_UI_DEFAULT_HEIGHT macro must be defined as well.
  525. */
  526. #define DISTRHO_UI_DEFAULT_WIDTH 300
  527. /**
  528. Default UI height to use when creating initial and temporary windows.@n
  529. Setting this macro allows to skip a temporary UI from being created in certain VST2 and VST3 hosts.
  530. (which would normally be done for knowing the UI size before host creates a window for it)
  531. Value must match 1x scale factor.
  532. When this macro is defined, the companion DISTRHO_UI_DEFAULT_WIDTH macro must be defined as well.
  533. */
  534. #define DISTRHO_UI_DEFAULT_HEIGHT 300
  535. /**
  536. Whether the %UI uses NanoVG for drawing instead of the default raw OpenGL calls.@n
  537. When enabled your %UI instance will subclass @ref NanoWidget instead of @ref Widget.
  538. */
  539. #define DISTRHO_UI_USE_NANOVG 1
  540. /**
  541. Whether the %UI is resizable to any size by the user.@n
  542. By default this is false, and resizing is only allowed under the plugin UI control,@n
  543. Enabling this options makes it possible for the user to resize the plugin UI at anytime.
  544. @see UI::setGeometryConstraints(uint, uint, bool, bool)
  545. */
  546. #define DISTRHO_UI_USER_RESIZABLE 1
  547. /**
  548. The %UI URI when exporting in LV2 format.@n
  549. By default this is set to @ref DISTRHO_PLUGIN_URI with "#UI" as suffix.
  550. */
  551. #define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#UI"
  552. /**
  553. The AudioUnit type for a plugin.@n
  554. This is a 4-character symbol, automatically set by DPF based on other plugin macros.
  555. See https://developer.apple.com/documentation/audiotoolbox/1584142-audio_unit_types for more information.
  556. */
  557. #define DISTRHO_PLUGIN_AU_TYPE aufx
  558. /**
  559. The AudioUnit subtype for a plugin.@n
  560. This is a 4-character symbol which identifies a plugin.@n
  561. It must be unique within a manufacturer's plugins, but different manufacturers can use the same subtype.
  562. @note This macro is required when building AU plugins
  563. */
  564. #define DISTRHO_PLUGIN_AU_SUBTYPE test
  565. /**
  566. The AudioUnit manufacturer for a plugin.@n
  567. This is a 4-character symbol with at least one non-lower case character.@n
  568. Plugins from the same brand/maker should use the same symbol.
  569. @note This macro is required when building AU plugins
  570. */
  571. #define DISTRHO_PLUGIN_AU_MANUFACTURER Dstr
  572. /**
  573. Custom LV2 category for the plugin.@n
  574. This is a single string, and can be one of the following values:
  575. - lv2:AllpassPlugin
  576. - lv2:AmplifierPlugin
  577. - lv2:AnalyserPlugin
  578. - lv2:BandpassPlugin
  579. - lv2:ChorusPlugin
  580. - lv2:CombPlugin
  581. - lv2:CompressorPlugin
  582. - lv2:ConstantPlugin
  583. - lv2:ConverterPlugin
  584. - lv2:DelayPlugin
  585. - lv2:DistortionPlugin
  586. - lv2:DynamicsPlugin
  587. - lv2:EQPlugin
  588. - lv2:EnvelopePlugin
  589. - lv2:ExpanderPlugin
  590. - lv2:FilterPlugin
  591. - lv2:FlangerPlugin
  592. - lv2:FunctionPlugin
  593. - lv2:GatePlugin
  594. - lv2:GeneratorPlugin
  595. - lv2:HighpassPlugin
  596. - lv2:InstrumentPlugin
  597. - lv2:LimiterPlugin
  598. - lv2:LowpassPlugin
  599. - lv2:MIDIPlugin
  600. - lv2:MixerPlugin
  601. - lv2:ModulatorPlugin
  602. - lv2:MultiEQPlugin
  603. - lv2:OscillatorPlugin
  604. - lv2:ParaEQPlugin
  605. - lv2:PhaserPlugin
  606. - lv2:PitchPlugin
  607. - lv2:ReverbPlugin
  608. - lv2:SimulatorPlugin
  609. - lv2:SpatialPlugin
  610. - lv2:SpectralPlugin
  611. - lv2:UtilityPlugin
  612. - lv2:WaveshaperPlugin
  613. See http://lv2plug.in/ns/lv2core for more information.
  614. */
  615. #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:Plugin"
  616. /**
  617. Custom VST3 categories for the plugin.@n
  618. This is a single concatenated string of categories, separated by a @c |.
  619. Each effect category can be one of the following values:
  620. - Fx
  621. - Fx|Ambisonics
  622. - Fx|Analyzer
  623. - Fx|Delay
  624. - Fx|Distortion
  625. - Fx|Dynamics
  626. - Fx|EQ
  627. - Fx|Filter
  628. - Fx|Instrument
  629. - Fx|Instrument|External
  630. - Fx|Spatial
  631. - Fx|Generator
  632. - Fx|Mastering
  633. - Fx|Modulation
  634. - Fx|Network
  635. - Fx|Pitch Shift
  636. - Fx|Restoration
  637. - Fx|Reverb
  638. - Fx|Surround
  639. - Fx|Tools
  640. Each instrument category can be one of the following values:
  641. - Instrument
  642. - Instrument|Drum
  643. - Instrument|External
  644. - Instrument|Piano
  645. - Instrument|Sampler
  646. - Instrument|Synth
  647. - Instrument|Synth|Sampler
  648. And extra categories possible for any plugin type:
  649. - Mono
  650. - Stereo
  651. */
  652. #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Stereo"
  653. /**
  654. Custom CLAP features for the plugin.@n
  655. This is a list of features defined as a string array body, without the terminating @c , or nullptr.
  656. A top-level category can be set as feature and be one of the following values:
  657. - instrument
  658. - audio-effect
  659. - note-effect
  660. - analyzer
  661. The following sub-categories can also be set:
  662. - synthesizer
  663. - sampler
  664. - drum
  665. - drum-machine
  666. - filter
  667. - phaser
  668. - equalizer
  669. - de-esser
  670. - phase-vocoder
  671. - granular
  672. - frequency-shifter
  673. - pitch-shifter
  674. - distortion
  675. - transient-shaper
  676. - compressor
  677. - limiter
  678. - flanger
  679. - chorus
  680. - delay
  681. - reverb
  682. - tremolo
  683. - glitch
  684. - utility
  685. - pitch-correction
  686. - restoration
  687. - multi-effects
  688. - mixing
  689. - mastering
  690. And finally the following audio capabilities can be set:
  691. - mono
  692. - stereo
  693. - surround
  694. - ambisonic
  695. */
  696. #define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "stereo"
  697. /**
  698. The plugin id when exporting in CLAP format, in reverse URI form.
  699. @note This macro is required when building CLAP plugins
  700. */
  701. #define DISTRHO_PLUGIN_CLAP_ID "studio.kx.distrho.effect"
  702. /** @} */
  703. /* ------------------------------------------------------------------------------------------------------------
  704. * Plugin Macros */
  705. /**
  706. @defgroup ExtraPluginMacros Extra Plugin Macros
  707. C Macros to customize DPF behaviour.
  708. These are macros that do not set plugin features or information, but instead change DPF internals.
  709. They are all optional.
  710. Unless stated otherwise, values are assumed to be a simple/empty define.
  711. @{
  712. */
  713. /**
  714. Whether to enable runtime plugin tests.@n
  715. This will check, during initialization of the plugin, if parameters, programs and states are setup properly.@n
  716. Useful to enable as part of CI, can safely be skipped.@n
  717. Under DPF makefiles this can be enabled by using `make DPF_RUNTIME_TESTING=true`.
  718. @note Some checks are only available with the GCC compiler,
  719. for detecting if a virtual function has been reimplemented.
  720. */
  721. #define DPF_RUNTIME_TESTING
  722. /**
  723. Whether to show parameter outputs in the VST2 plugins.@n
  724. This is disabled (unset) by default, as the VST2 format has no notion of read-only parameters.
  725. */
  726. #define DPF_VST_SHOW_PARAMETER_OUTPUTS
  727. /**
  728. Disable all file browser related code.@n
  729. Must be set as compiler macro when building DGL. (e.g. `CXXFLAGS="-DDGL_FILE_BROWSER_DISABLED"`)
  730. */
  731. #define DGL_FILE_BROWSER_DISABLED
  732. /**
  733. Disable resource files, like internally used fonts.@n
  734. Must be set as compiler macro when building DGL. (e.g. `CXXFLAGS="-DDGL_NO_SHARED_RESOURCES"`)
  735. */
  736. #define DGL_NO_SHARED_RESOURCES
  737. /**
  738. Whether to use OpenGL3 instead of the default OpenGL2 compatility profile.
  739. Under DPF makefiles this can be enabled by using `make USE_OPENGL3=true` on the dgl build step.
  740. @note This is experimental and incomplete, contributions are welcome and appreciated.
  741. */
  742. #define DGL_USE_OPENGL3
  743. /** @} */
  744. /* ------------------------------------------------------------------------------------------------------------
  745. * Namespace Macros */
  746. /**
  747. @defgroup NamespaceMacros Namespace Macros
  748. C Macros to use and customize DPF namespaces.
  749. These are macros that serve as helpers around C++ namespaces, and also as a way to set custom namespaces during a build.
  750. @{
  751. */
  752. /**
  753. Compiler macro that sets the C++ namespace for DPF plugins.@n
  754. If unset during build, it will use the name @b DISTRHO by default.
  755. Unless you know exactly what you are doing, you do need to modify this value.@n
  756. The only probable useful case for customizing it is if you are building a big collection of very similar DPF-based plugins in your application.@n
  757. For example, having 2 different versions of the same plugin that should behave differently but still exist within the same binary.
  758. On macOS (where due to Objective-C restrictions all code that interacts with Cocoa needs to be in a flat namespace),
  759. DPF will automatically use the plugin name as prefix to flat namespace functions in order to avoid conflicts.
  760. So, basically, it is DPF's job to make sure plugin binaries are 100% usable as-is.@n
  761. You typically do not need to care about this at all.
  762. */
  763. #define DISTRHO_NAMESPACE DISTRHO
  764. /**
  765. Compiler macro that begins the C++ namespace for @b DISTRHO, as needed for (the DSP side of) plugins.@n
  766. All classes in DPF are within this namespace except for UI/graphics stuff.
  767. @see END_NAMESPACE_DISTRHO
  768. */
  769. #define START_NAMESPACE_DISTRHO namespace DISTRHO_NAMESPACE {
  770. /**
  771. Close the namespace previously started by @ref START_NAMESPACE_DISTRHO.@n
  772. This doesn't really need to be a macro, it is just prettier/more consistent that way.
  773. */
  774. #define END_NAMESPACE_DISTRHO }
  775. /**
  776. Make the @b DISTRHO namespace available in the current function scope.@n
  777. This is not set by default in order to avoid conflicts with commonly used names such as "Parameter" and "Plugin".
  778. */
  779. #define USE_NAMESPACE_DISTRHO using namespace DISTRHO_NAMESPACE;
  780. /* TODO
  781. *
  782. * DISTRHO_MACRO_AS_STRING_VALUE
  783. * DISTRHO_MACRO_AS_STRING
  784. * DISTRHO_PROPER_CPP11_SUPPORT
  785. * DONT_SET_USING_DISTRHO_NAMESPACE
  786. *
  787. */
  788. // -----------------------------------------------------------------------------------------------------------
  789. END_NAMESPACE_DISTRHO
  790. #endif // DOXYGEN