19 #include "src/DistrhoDefines.h"
21 START_NAMESPACE_DISTRHO
58 : Plugin(0, 0, 0) // 0 parameters, 0 programs and 0 states
63 /* ----------------------------------------------------------------------------------------
70 const char* getLabel() const override
78 const char* getMaker() const override
87 const char* getLicense() const override
96 uint32_t getVersion() const override
105 int64_t getUniqueId() const override
107 return cconst('M', 'u', 't', 'e');
110 /* ----------------------------------------------------------------------------------------
111 * This example has no parameters, so skip parameter stuff */
113 void initParameter(uint32_t, Parameter&) override {}
114 float getParameterValue(uint32_t) const override { return 0.0f; }
115 void setParameterValue(uint32_t, float) override {}
117 /* ----------------------------------------------------------------------------------------
118 * Audio/MIDI Processing */
124 void run(const float**, float** outputs, uint32_t frames) override
126 // get the left and right audio outputs
127 float* const outL = outputs[0];
128 float* const outR = outputs[1];
131 std::memset(outL, 0, sizeof(float)*frames);
132 std::memset(outR, 0, sizeof(float)*frames);
138 See the Plugin class for more information and to understand what each function does.
141 A plugin is nothing without parameters.@n
142 In DPF parameters can be inputs or outputs.@n
143 They have hints to describe how they behave plus a name and a symbol identifying them.@n
144 Parameters also have 'ranges' – a minimum, maximum and default value.
146 Input parameters are "read-only": the plugin can read them but not change them.
147 (the exception being when changing programs, more on that below)@n
148 It's the host responsibility to save, restore and set input parameters.
150 Output parameters can be changed at anytime by the plugin.@n
151 The host will simply read their values and not change them.
153 Here's an example of an audio plugin that has 1 input parameter:
155 class GainPlugin : public Plugin
163 : Plugin(1, 0, 0), // 1 parameter, 0 programs and 0 states
169 /* ----------------------------------------------------------------------------------------
172 const char* getLabel() const override
177 const char* getMaker() const override
182 const char* getLicense() const override
187 uint32_t getVersion() const override
192 int64_t getUniqueId() const override
194 return cconst('M', 'u', 't', 'e');
197 /* ----------------------------------------------------------------------------------------
204 void initParameter(uint32_t index, Parameter& parameter) override
206 // we only have one parameter so we can skip checking the index
208 parameter.hints = kParameterIsAutomable;
209 parameter.name = "Gain";
210 parameter.symbol = "gain";
213 /* ----------------------------------------------------------------------------------------
219 float getParameterValue(uint32_t index) const override
221 // same as before, ignore index check
229 void setParameterValue(uint32_t index, float value) override
231 // same as before, ignore index check
236 /* ----------------------------------------------------------------------------------------
237 * Audio/MIDI Processing */
239 void run(const float**, float** outputs, uint32_t frames) override
241 // get the mono input and output
242 const float* const in = inputs[0];
243 /* */ float* const out = outputs[0];
245 // apply gain against all samples
246 for (uint32_t i=0; i < frames; ++i)
247 out[i] = in[i] * fGain;
252 See the Parameter struct for more information about parameters.
266 @section Time-Position
273 /* ------------------------------------------------------------------------------------------------------------
303 #define DISTRHO_PLUGIN_NAME "Plugin Name"
309 #define DISTRHO_PLUGIN_NUM_INPUTS 2
315 #define DISTRHO_PLUGIN_NUM_OUTPUTS 2
321 #define DISTRHO_PLUGIN_URI "urn:distrho:name"
328 #define DISTRHO_PLUGIN_HAS_UI 1
334 #define DISTRHO_PLUGIN_IS_RT_SAFE 1
341 #define DISTRHO_PLUGIN_IS_SYNTH 1
349 #define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
355 #define DISTRHO_PLUGIN_WANT_LATENCY 1
361 #define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1
367 #define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1
374 #define DISTRHO_PLUGIN_WANT_PROGRAMS 1
381 #define DISTRHO_PLUGIN_WANT_STATE 1
387 #define DISTRHO_PLUGIN_WANT_TIMEPOS 1
393 #define DISTRHO_UI_USE_NANOVG 1
399 #define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#UI"
403 // -----------------------------------------------------------------------------------------------------------
405 END_NAMESPACE_DISTRHO