19 #include "src/DistrhoDefines.h"
58 #include "DistrhoPlugin.hpp"
70 class MutePlugin :
public Plugin
89 const char*
getLabel()
const override
97 const char*
getMaker()
const override
125 return d_cconst(
'M',
'u',
't',
'e');
134 void run(
const float**,
float** outputs, uint32_t frames)
override
137 float*
const outL = outputs[0];
138 float*
const outR = outputs[1];
141 std::memset(outL, 0,
sizeof(
float)*frames);
142 std::memset(outR, 0,
sizeof(
float)*frames);
153 return new MutePlugin();
157 See the
Plugin class for more information.
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.
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.
169 Output parameters can be changed at anytime by the plugin.@n
170 The host will simply read their values and never change them.
172 Here's an example of an audio plugin that has 1 input parameter:
174 class GainPlugin :
public Plugin
191 const char* getLabel()
const override
196 const char* getMaker()
const override
201 const char* getLicense()
const override
206 uint32_t getVersion()
const override
211 int64_t getUniqueId()
const override
213 return d_cconst(
'G',
'a',
'i',
'n');
223 void initParameter(uint32_t index,
Parameter& parameter)
override
228 parameter.
name =
"Gain";
229 parameter.
symbol =
"gain";
241 float getParameterValue(uint32_t index)
const override
251 void setParameterValue(uint32_t index,
float value)
override
261 void run(
const float**,
float** outputs, uint32_t frames)
override
264 const float*
const in = inputs[0];
265 float*
const out = outputs[0];
268 for (uint32_t i=0; i < frames; ++i)
269 out[i] = in[i] * fGain;
277 See the
Parameter struct for more information about parameters.
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.
284 When enabled you'll need to override 2 new function in your plugin code,
287 Here's an example of a plugin with a "default" program:
289 class PluginWithPresets :
public Plugin
303 const char* getLabel()
const override
308 const char* getMaker()
const override
313 const char* getLicense()
const override
318 uint32_t getVersion()
const override
323 int64_t getUniqueId()
const override
325 return d_cconst(
'P',
'r',
'o',
'g');
335 void initParameter(uint32_t index,
Parameter& parameter)
override
345 parameter.
name =
"Gain Right";
346 parameter.
symbol =
"gainR";
349 parameter.
name =
"Gain Left";
350 parameter.
symbol =
"gainL";
359 void initProgramName(uint32_t index,
String& programName)
363 programName =
"Default";
372 float getParameterValue(uint32_t index)
const override
388 void setParameterValue(uint32_t index,
float value)
override
404 void loadProgram(uint32_t index)
415 void run(
const float**,
float** outputs, uint32_t frames)
override
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];
424 for (uint32_t i=0; i < frames; ++i)
426 outL[i] = inL[i] * fGainL;
427 outR[i] = inR[i] * fGainR;
432 float fGainL, fGainR;
436 This is a work-in-progress documentation page. States, MIDI, Latency, Time-Position and
UI are still TODO.
449 @section Time-Position
488 #define DISTRHO_PLUGIN_NAME "Plugin Name"
494 #define DISTRHO_PLUGIN_NUM_INPUTS 2
500 #define DISTRHO_PLUGIN_NUM_OUTPUTS 2
506 #define DISTRHO_PLUGIN_URI "urn:distrho:name"
513 #define DISTRHO_PLUGIN_HAS_UI 1
519 #define DISTRHO_PLUGIN_IS_RT_SAFE 1
526 #define DISTRHO_PLUGIN_IS_SYNTH 1
532 #define DISTRHO_PLUGIN_MINIMUM_BUFFER_SIZE 2048
540 #define DISTRHO_PLUGIN_USES_MODGUI 0
548 #define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
554 #define DISTRHO_PLUGIN_WANT_LATENCY 1
560 #define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1
566 #define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1
574 #define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 1
581 #define DISTRHO_PLUGIN_WANT_PROGRAMS 1
588 #define DISTRHO_PLUGIN_WANT_STATE 1
598 #define DISTRHO_PLUGIN_WANT_FULL_STATE 1
604 #define DISTRHO_PLUGIN_WANT_TIMEPOS 1
610 #define DISTRHO_UI_USE_CUSTOM 1
617 #define DISTRHO_UI_CUSTOM_INCLUDE_PATH
626 #define DISTRHO_UI_CUSTOM_WIDGET_TYPE
637 #define DISTRHO_UI_DEFAULT_WIDTH 300
648 #define DISTRHO_UI_DEFAULT_HEIGHT 300
654 #define DISTRHO_UI_USE_NANOVG 1
662 #define DISTRHO_UI_USER_RESIZABLE 1
668 #define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#UI"
675 #define DISTRHO_PLUGIN_AU_TYPE aufx
684 #define DISTRHO_PLUGIN_BRAND_ID Dstr
691 #define DISTRHO_PLUGIN_UNIQUE_ID test
738 #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:Plugin"
782 #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Stereo"
840 #define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "stereo"
846 #define DISTRHO_PLUGIN_CLAP_ID "studio.kx.distrho.effect"
874 #define DPF_RUNTIME_TESTING
880 #define DPF_VST_SHOW_PARAMETER_OUTPUTS
886 #define DPF_VST3_DONT_USE_BRAND_ID
892 #define DGL_FILE_BROWSER_DISABLED
898 #define DGL_NO_SHARED_RESOURCES
906 #define DGL_USE_OPENGL3
936 #define DISTRHO_NAMESPACE DISTRHO
943 #define START_NAMESPACE_DISTRHO namespace DISTRHO_NAMESPACE {
949 #define END_NAMESPACE_DISTRHO }
955 #define USE_NAMESPACE_DISTRHO using namespace DISTRHO_NAMESPACE;
Definition: DistrhoPlugin.hpp:61
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:35
Definition: DistrhoUI.hpp:78
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:72
static constexpr uint32_t d_version(const uint8_t major, const uint8_t minor, const uint8_t micro) noexcept
Definition: DistrhoUtils.hpp:90
#define END_NAMESPACE_DISTRHO
Definition: DistrhoInfo.hpp:949
#define START_NAMESPACE_DISTRHO
Definition: DistrhoInfo.hpp:943
#define USE_NAMESPACE_DISTRHO
Definition: DistrhoInfo.hpp:955
static constexpr const uint32_t kParameterIsAutomatable
Definition: DistrhoDetails.hpp:96
#define DISTRHO_PLUGIN_WANT_PROGRAMS
Definition: DistrhoInfo.hpp:581
float max
Definition: DistrhoDetails.hpp:338
float min
Definition: DistrhoDetails.hpp:333
float def
Definition: DistrhoDetails.hpp:328
Definition: DistrhoDetails.hpp:588
ParameterRanges ranges
Definition: DistrhoDetails.hpp:634
uint32_t hints
Definition: DistrhoDetails.hpp:593
String symbol
Definition: DistrhoDetails.hpp:615
String name
Definition: DistrhoDetails.hpp:600