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