zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

DynamicFilter.cpp (4819B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   DynamicFilter.cpp - DPF + Zyn Plugin for DynamicFilter
      5   Copyright (C) 2015 Filipe Coelho
      6   Author: Filipe Coelho
      7 
      8   This program is free software; you can redistribute it and/or
      9   modify it under the terms of the GNU General Public License
     10   as published by the Free Software Foundation; either version 2
     11   of the License, or (at your option) any later version.
     12 */
     13 
     14 // DPF includes
     15 #include "../AbstractFX.hpp"
     16 
     17 // ZynAddSubFX includes
     18 #include "Effects/DynamicFilter.h"
     19 
     20 /* ------------------------------------------------------------------------------------------------------------
     21  * DynamicFilter plugin class */
     22 
     23 class DynamicFilterPlugin : public AbstractPluginFX<zyn::DynamicFilter>
     24 {
     25 public:
     26     DynamicFilterPlugin()
     27         : AbstractPluginFX(10, 5) {}
     28 
     29 protected:
     30    /* --------------------------------------------------------------------------------------------------------
     31     * Information */
     32 
     33    /**
     34       Get the plugin label.
     35       This label is a short restricted name consisting of only _, a-z, A-Z and 0-9 characters.
     36     */
     37     const char* getLabel() const noexcept override
     38     {
     39         return "DynamicFilter";
     40     }
     41 
     42    /**
     43       Get an extensive comment/description about the plugin.
     44     */
     45     const char* getDescription() const noexcept override
     46     {
     47         // TODO
     48         return "";
     49     }
     50 
     51    /**
     52       Get the plugin unique Id.
     53       This value is used by LADSPA, DSSI and VST plugin formats.
     54     */
     55     int64_t getUniqueId() const noexcept override
     56     {
     57         return d_cconst('Z', 'X', 'd', 'f');
     58     }
     59 
     60    /* --------------------------------------------------------------------------------------------------------
     61     * Init */
     62 
     63    /**
     64       Initialize the parameter @a index.
     65       This function will be called once, shortly after the plugin is created.
     66     */
     67     void initParameter(uint32_t index, Parameter& parameter) noexcept override
     68     {
     69         parameter.hints = kParameterIsInteger|kParameterIsAutomable;
     70         parameter.unit  = "";
     71         parameter.ranges.min = 0.0f;
     72         parameter.ranges.max = 127.0f;
     73 
     74         switch (index)
     75         {
     76         case 0:
     77             parameter.name   = "LFO Frequency";
     78             parameter.symbol = "lfofreq";
     79             parameter.ranges.def = 80.0f;
     80             break;
     81         case 1:
     82             parameter.name   = "LFO Randomness";
     83             parameter.symbol = "lforand";
     84             parameter.ranges.def = 0.0f;
     85             break;
     86         case 2:
     87             parameter.name   = "LFO Type";
     88             parameter.symbol = "lfotype";
     89             parameter.ranges.def = 0.0f;
     90             parameter.ranges.max = 1.0f;
     91             /*
     92             TODO: support for scalePoints in DPF
     93             scalePoints[0].label = "Sine";
     94             scalePoints[1].label = "Triangle";
     95             scalePoints[0].value = 0.0f;
     96             scalePoints[1].value = 1.0f;
     97             */
     98             break;
     99         case 3:
    100             parameter.name   = "LFO Stereo";
    101             parameter.symbol = "lfostereo";
    102             parameter.ranges.def = 64.0f;
    103             break;
    104         case 4:
    105             parameter.name   = "LFO Depth";
    106             parameter.symbol = "lfodepth";
    107             parameter.ranges.def = 0.0f;
    108             break;
    109         case 5:
    110             parameter.name   = "Amp sns";
    111             parameter.symbol = "ampsns";
    112             parameter.ranges.def = 90.0f;
    113             break;
    114         case 6:
    115             parameter.hints |= kParameterIsBoolean;
    116             parameter.name   = "Amp sns inv";
    117             parameter.symbol = "ampsnsinv";
    118             parameter.ranges.def = 0.0f;
    119             parameter.ranges.max = 1.0f;
    120             break;
    121         case 7:
    122             parameter.name   = "Amp Smooth";
    123             parameter.symbol = "ampsmooth";
    124             parameter.ranges.def = 60.0f;
    125             break;
    126         }
    127     }
    128 
    129    /**
    130       Set the name of the program @a index.
    131       This function will be called once, shortly after the plugin is created.
    132     */
    133     void initProgramName(uint32_t index, String& programName) noexcept override
    134     {
    135         switch (index)
    136         {
    137         case 0:
    138             programName = "Wah Wah";
    139             break;
    140         case 1:
    141             programName = "Auto Wah";
    142             break;
    143         case 2:
    144             programName = "Sweep";
    145             break;
    146         case 3:
    147             programName = "Vocal Morph 1";
    148             break;
    149         case 4:
    150             programName = "Vocal Morph 2";
    151             break;
    152         }
    153     }
    154 
    155     DISTRHO_DECLARE_NON_COPY_CLASS(DynamicFilterPlugin)
    156 };
    157 
    158 /* ------------------------------------------------------------------------------------------------------------
    159  * Create plugin, entry point */
    160 
    161 START_NAMESPACE_DISTRHO
    162 
    163 Plugin* createPlugin()
    164 {
    165     return new DynamicFilterPlugin();
    166 }
    167 
    168 END_NAMESPACE_DISTRHO