19 #include "src/DistrhoDefines.h"
67 class MutePlugin :
public Plugin
86 const char*
getLabel()
const override
94 const char*
getMaker()
const override
122 return d_cconst(
'M',
'u',
't',
'e');
131 void run(
const float**,
float** outputs, uint32_t frames)
override
134 float*
const outL = outputs[0];
135 float*
const outR = outputs[1];
138 std::memset(outL, 0,
sizeof(
float)*frames);
139 std::memset(outR, 0,
sizeof(
float)*frames);
150 return new MutePlugin();
154 See the
Plugin class for more information.
157 A plugin is nothing without parameters.@n
158 In DPF parameters can be inputs or outputs.@n
159 They have hints to describe how they behave plus a name and a symbol identifying them.@n
160 Parameters also have 'ranges' – a minimum, maximum and default value.
162 Input parameters are by default "read-only": the plugin can read them but not change them.
163 (there are exceptions and possibly a request to the host to change values, more on that below)@n
164 It's the host responsibility to save, restore and set input parameters.
166 Output parameters can be changed at anytime by the plugin.@n
167 The host will simply read their values and never change them.
169 Here's an example of an audio plugin that has 1 input parameter:
171 class GainPlugin :
public Plugin
188 const char* getLabel()
const override
193 const char* getMaker()
const override
198 const char* getLicense()
const override
203 uint32_t getVersion()
const override
208 int64_t getUniqueId()
const override
210 return d_cconst(
'G',
'a',
'i',
'n');
220 void initParameter(uint32_t index,
Parameter& parameter)
override
225 parameter.
name =
"Gain";
226 parameter.
symbol =
"gain";
238 float getParameterValue(uint32_t index)
const override
248 void setParameterValue(uint32_t index,
float value)
override
258 void run(
const float**,
float** outputs, uint32_t frames)
override
261 const float*
const in = inputs[0];
262 float*
const out = outputs[0];
265 for (uint32_t i=0; i < frames; ++i)
266 out[i] = in[i] * fGain;
274 See the
Parameter struct for more information about parameters.
277 Programs in DPF refer to plugin-side presets (usually called "factory presets").@n
278 This is meant as an initial set of presets provided by plugin authors included in the actual plugin.
281 When enabled you'll need to override 2 new function in your plugin code,
284 Here's an example of a plugin with a "default" program:
286 class PluginWithPresets :
public Plugin
300 const char* getLabel()
const override
305 const char* getMaker()
const override
310 const char* getLicense()
const override
315 uint32_t getVersion()
const override
320 int64_t getUniqueId()
const override
322 return d_cconst(
'P',
'r',
'o',
'g');
332 void initParameter(uint32_t index,
Parameter& parameter)
override
342 parameter.
name =
"Gain Right";
343 parameter.
symbol =
"gainR";
346 parameter.
name =
"Gain Left";
347 parameter.
symbol =
"gainL";
356 void initProgramName(uint32_t index,
String& programName)
360 programName =
"Default";
369 float getParameterValue(uint32_t index)
const override
383 void setParameterValue(uint32_t index,
float value)
override
399 void loadProgram(uint32_t index)
410 void run(
const float**,
float** outputs, uint32_t frames)
override
413 const float*
const inL = inputs[0];
414 const float*
const inR = inputs[0];
415 float*
const outL = outputs[0];
416 float*
const outR = outputs[0];
419 for (uint32_t i=0; i < frames; ++i)
421 outL[i] = inL[i] * fGainL;
422 outR[i] = inR[i] * fGainR;
427 float fGainL, fGainR;
431 This is a work-in-progress documentation page. States, MIDI, Latency, Time-Position and
UI are still TODO.
444 @section Time-Position
481 #define DISTRHO_PLUGIN_NAME "Plugin Name"
487 #define DISTRHO_PLUGIN_NUM_INPUTS 2
493 #define DISTRHO_PLUGIN_NUM_OUTPUTS 2
499 #define DISTRHO_PLUGIN_URI "urn:distrho:name"
506 #define DISTRHO_PLUGIN_HAS_UI 1
512 #define DISTRHO_PLUGIN_IS_RT_SAFE 1
519 #define DISTRHO_PLUGIN_IS_SYNTH 1
525 #define DISTRHO_PLUGIN_MINIMUM_BUFFER_SIZE 2048
533 #define DISTRHO_PLUGIN_USES_MODGUI 0
541 #define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
547 #define DISTRHO_PLUGIN_WANT_LATENCY 1
553 #define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1
559 #define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1
567 #define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 1
574 #define DISTRHO_PLUGIN_WANT_PROGRAMS 1
581 #define DISTRHO_PLUGIN_WANT_STATE 1
591 #define DISTRHO_PLUGIN_WANT_FULL_STATE 1
597 #define DISTRHO_PLUGIN_WANT_TIMEPOS 1
603 #define DISTRHO_UI_USE_CUSTOM 1
610 #define DISTRHO_UI_CUSTOM_INCLUDE_PATH
619 #define DISTRHO_UI_CUSTOM_WIDGET_TYPE
625 #define DISTRHO_UI_USE_NANOVG 1
633 #define DISTRHO_UI_USER_RESIZABLE 1
639 #define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#UI"
687 #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:Plugin"
728 #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx"
756 #define DPF_RUNTIME_TESTING
762 #define DPF_VST_SHOW_PARAMETER_OUTPUTS
768 #define DGL_FILE_BROWSER_DISABLED
774 #define DGL_NO_SHARED_RESOURCES
782 #define DGL_USE_OPENGL3
791 #define VESTIGE_HEADER 1
821 #define DISTRHO_NAMESPACE DISTRHO
828 #define START_NAMESPACE_DISTRHO namespace DISTRHO_NAMESPACE {
834 #define END_NAMESPACE_DISTRHO }
840 #define USE_NAMESPACE_DISTRHO using namespace DISTRHO_NAMESPACE;
Definition: DistrhoPlugin.hpp:906
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:74
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:834
#define START_NAMESPACE_DISTRHO
Definition: DistrhoInfo.hpp:828
#define USE_NAMESPACE_DISTRHO
Definition: DistrhoInfo.hpp:840
static const uint32_t kParameterIsAutomatable
Definition: DistrhoPlugin.hpp:92
#define DISTRHO_PLUGIN_WANT_PROGRAMS
Definition: DistrhoInfo.hpp:574
float max
Definition: DistrhoPlugin.hpp:311
float min
Definition: DistrhoPlugin.hpp:306
float def
Definition: DistrhoPlugin.hpp:301
Definition: DistrhoPlugin.hpp:497
ParameterRanges ranges
Definition: DistrhoPlugin.hpp:543
uint32_t hints
Definition: DistrhoPlugin.hpp:502
String symbol
Definition: DistrhoPlugin.hpp:524
String name
Definition: DistrhoPlugin.hpp:509