19#include "src/DafDefines.h"
58 #include "DafPlugin.hpp"
70 class MutePlugin :
public Plugin
89 const char* getLabel()
const override
97 const char* getMaker()
const override
106 const char* getLicense()
const override
114 uint32_t getVersion()
const override
116 return d_version(1, 0, 0);
123 int64_t getUniqueId()
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 DAF 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
208 return d_version(1, 0, 0);
211 int64_t getUniqueId()
const override
213 return d_cconst(
'G',
'a',
'i',
'n');
223 void initParameter(uint32_t index, Parameter& parameter)
override
227 parameter.
hints = kParameterIsAutomatable;
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 DAF 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.
283 To use programs you must first enable them by setting @ref
DAF_PLUGIN_WANT_PROGRAMS to 1 in your DafPluginInfo.h file.@n
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
320 return d_version(1, 0, 0);
323 int64_t getUniqueId()
const override
325 return d_cconst(
'P',
'r',
'o',
'g');
335 void initParameter(uint32_t index, Parameter& parameter)
override
337 parameter.
hints = kParameterIsAutomatable;
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 DAF_PLUGIN_NAME "Plugin Name"
494#define DAF_PLUGIN_NUM_INPUTS 2
500#define DAF_PLUGIN_NUM_OUTPUTS 2
506#define DAF_PLUGIN_URI "urn:daf:name"
513#define DAF_PLUGIN_HAS_UI 1
519#define DAF_PLUGIN_IS_RT_SAFE 1
526#define DAF_PLUGIN_IS_SYNTH 1
532#define DAF_PLUGIN_MINIMUM_BUFFER_SIZE 2048
540#define DAF_PLUGIN_USES_MODGUI 0
548#define DAF_PLUGIN_WANT_DIRECT_ACCESS 0
554#define DAF_PLUGIN_WANT_LATENCY 1
561#define DAF_PLUGIN_WANT_TAIL 1
567#define DAF_PLUGIN_WANT_MIDI_AS_MPE 0
573#define DAF_PLUGIN_WANT_MIDI_INPUT 1
579#define DAF_PLUGIN_WANT_MIDI_OUTPUT 1
587#define DAF_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 1
594#define DAF_PLUGIN_WANT_PROGRAMS 1
601#define DAF_PLUGIN_WANT_STATE 1
611#define DAF_PLUGIN_WANT_FULL_STATE 1
617#define DAF_PLUGIN_WANT_TIMEPOS 1
623#define DAF_UI_USE_CAIRO 1
629#define DAF_UI_USE_CUSTOM 1
636#define DAF_UI_CUSTOM_INCLUDE_PATH
642#define DAF_UI_USE_NANOVG 1
651#define DAF_UI_CUSTOM_WIDGET_TYPE
662#define DAF_UI_DEFAULT_WIDTH 300
673#define DAF_UI_DEFAULT_HEIGHT 300
681#define DAF_UI_USER_RESIZABLE 1
687#define DAF_UI_FILE_BROWSER 1
693#define DAF_UI_WEB_VIEW 1
699#define DAF_UI_URI DAF_PLUGIN_URI "#UI"
706#define DAF_PLUGIN_AU_TYPE aufx
715#define DAF_PLUGIN_BRAND_ID Dstr
722#define DAF_PLUGIN_UNIQUE_ID test
769#define DAF_PLUGIN_LV2_CATEGORY "lv2:Plugin"
813#define DAF_PLUGIN_VST3_CATEGORIES "Fx|Stereo"
871#define DAF_PLUGIN_CLAP_FEATURES "audio-effect", "stereo"
877#define DAF_PLUGIN_CLAP_ID "studio.kx.daf.effect"
883#define DAF_PLUGIN_ABBREVIATION "DFX"
889#define DAF_PLUGIN_ANAGRAM_BLOCK_IMAGE_OFF "anagram-block-off.png"
895#define DAF_PLUGIN_ANAGRAM_BLOCK_IMAGE_ON "anagram-block-on.png"
923#define DAF_RUNTIME_TESTING
929#define DAF_VST_SHOW_PARAMETER_OUTPUTS
935#define DAF_VST3_DONT_USE_BRAND_ID
947#define DAF_VST3_CROSS_PLATFORM_UID
953#define DGL_NO_SHARED_RESOURCES
983#define DAF_NAMESPACE DAF
990#define START_NAMESPACE_DAF namespace DAF_NAMESPACE {
996#define END_NAMESPACE_DAF }
1002#define USE_NAMESPACE_DAF using namespace DAF_NAMESPACE;
Definition DafPlugin.hpp:61
virtual void loadProgram(uint32_t index)
#define USE_NAMESPACE_DAF
Definition DafInfo.hpp:1002
#define END_NAMESPACE_DAF
Definition DafInfo.hpp:996
#define START_NAMESPACE_DAF
Definition DafInfo.hpp:990
#define DAF_PLUGIN_WANT_PROGRAMS
Definition DafInfo.hpp:594
float max
Definition DafDetails.hpp:366
float min
Definition DafDetails.hpp:361
float def
Definition DafDetails.hpp:356
ParameterRanges ranges
Definition DafDetails.hpp:653
uint32_t hints
Definition DafDetails.hpp:612
String symbol
Definition DafDetails.hpp:634
String name
Definition DafDetails.hpp:619