19 #include "src/DistrhoDefines.h" 
   21 START_NAMESPACE_DISTRHO
 
   70       const char* getLabel()
 const override 
   78       const char* getMaker()
 const override 
   87       const char* getLicense()
 const override 
   95       uint32_t getVersion()
 const override 
   97           return d_version(1, 0, 0);
 
  104       int64_t getUniqueId()
 const override 
  106           return d_cconst(
'M', 
'u', 
't', 
'e');
 
  112       void  initParameter(uint32_t, 
Parameter&)
 override {}
 
  113       float getParameterValue(uint32_t)
 const   override { 
return 0.0f; }
 
  114       void  setParameterValue(uint32_t, 
float)
  override {}
 
  123       void run(
const float**, 
float** outputs, uint32_t frames)
 override 
  126           float* 
const outL = outputs[0];
 
  127           float* 
const outR = outputs[1];
 
  130           std::memset(outL, 0, 
sizeof(
float)*frames);
 
  131           std::memset(outR, 0, 
sizeof(
float)*frames);
 
  137    See the 
Plugin class for more information and to understand what each function does.
 
  140    A plugin is nothing without parameters.@n
 
  141    In DPF parameters can be inputs or outputs.@n
 
  142    They have hints to describe how they behave plus a name and a symbol identifying them.@n
 
  143    Parameters also have 'ranges' – a minimum, maximum and default value.
 
  145    Input parameters are "read-only": the plugin can read them but not change them.
 
  146    (the exception being when changing programs, more on that below)@n
 
  147    It's the host responsibility to save, restore and set input parameters.
 
  149    Output parameters can be changed at anytime by the plugin.@n
 
  150    The host will simply read their values and not change them.
 
  152    Here's an example of an audio plugin that has 1 input parameter:
 
  154    class GainPlugin : 
public Plugin 
  171       const char* getLabel()
 const override 
  176       const char* getMaker()
 const override 
  181       const char* getLicense()
 const override 
  186       uint32_t getVersion()
 const override 
  188           return d_version(1, 0, 0);
 
  191       int64_t getUniqueId()
 const override 
  193           return d_cconst(
'G', 
'a', 
'i', 
'n');
 
  203       void initParameter(uint32_t index, 
Parameter& parameter)
 override 
  208           parameter.
name       = 
"Gain";
 
  209           parameter.
symbol     = 
"gain";
 
  221       float getParameterValue(uint32_t index)
 const override 
  231       void setParameterValue(uint32_t index, 
float value)
 override 
  241       void run(
const float**, 
float** outputs, uint32_t frames)
 override 
  244           const float* 
const in  = inputs[0];
 
  245            float* 
const out = outputs[0];
 
  248           for (uint32_t i=0; i < frames; ++i)
 
  249               out[i] = in[i] * fGain;
 
  257    See the 
Parameter struct for more information about parameters.
 
  260    Programs in DPF refer to plugin-side presets (usually called "factory presets"),
 
  261    an initial set of presets provided by plugin authors included in the actual plugin.
 
  264    When enabled you'll need to override 2 new function in your plugin code,
 
  267    Here's an example of a plugin with a "default" program:
 
  269    class PluginWithPresets : 
public Plugin 
  283       const char* getLabel()
 const override 
  288       const char* getMaker()
 const override 
  293       const char* getLicense()
 const override 
  298       uint32_t getVersion()
 const override 
  300           return d_version(1, 0, 0);
 
  303       int64_t getUniqueId()
 const override 
  305           return d_cconst(
'P', 
'r', 
'o', 
'g');
 
  315       void initParameter(uint32_t index, 
Parameter& parameter)
 override 
  325               parameter.
name   = 
"Gain Right";
 
  326               parameter.
symbol = 
"gainR";
 
  329               parameter.
name   = 
"Gain Left";
 
  330               parameter.
symbol = 
"gainL";
 
  339       void initProgramName(uint32_t index, 
String& programName)
 
  344               programName = 
"Default";
 
  355       float getParameterValue(uint32_t index)
 const override 
  369       void setParameterValue(uint32_t index, 
float value)
 override 
  385       void loadProgram(uint32_t index)
 
  399       void run(
const float**, 
float** outputs, uint32_t frames)
 override 
  402           const float* 
const inL  = inputs[0];
 
  403           const float* 
const inR  = inputs[0];
 
  404            float* 
const outL = outputs[0];
 
  405            float* 
const outR = outputs[0];
 
  408           for (uint32_t i=0; i < frames; ++i)
 
  410               outL[i] = inL[i] * fGainL;
 
  411               outR[i] = inR[i] * fGainR;
 
  416       float fGainL, fGainR;
 
  420    This is a work-in-progress documentation page. States, MIDI, Latency, Time-Position and 
UI are still TODO.
 
  433    @section Time-Position
 
  470 #define DISTRHO_PLUGIN_NAME "Plugin Name" 
  476 #define DISTRHO_PLUGIN_NUM_INPUTS 2 
  482 #define DISTRHO_PLUGIN_NUM_OUTPUTS 2 
  488 #define DISTRHO_PLUGIN_URI "urn:distrho:name" 
  495 #define DISTRHO_PLUGIN_HAS_UI 1 
  501 #define DISTRHO_PLUGIN_IS_RT_SAFE 1 
  508 #define DISTRHO_PLUGIN_IS_SYNTH 1 
  516 #define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0 
  522 #define DISTRHO_PLUGIN_WANT_LATENCY 1 
  528 #define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1 
  534 #define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1 
  542 #define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 1 
  549 #define DISTRHO_PLUGIN_WANT_PROGRAMS 1 
  556 #define DISTRHO_PLUGIN_WANT_STATE 1 
  566 #define DISTRHO_PLUGIN_WANT_FULL_STATE 1 
  572 #define DISTRHO_PLUGIN_WANT_TIMEPOS 1 
  578 #define DISTRHO_UI_USE_CUSTOM 1 
  585 #define DISTRHO_UI_CUSTOM_INCLUDE_PATH 
  594 #define DISTRHO_UI_CUSTOM_WIDGET_TYPE 
  600 #define DISTRHO_UI_USE_NANOVG 1 
  608 #define DISTRHO_UI_USER_RESIZABLE 1 
  614 #define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#UI" 
  620 END_NAMESPACE_DISTRHO