zynaddsubfx

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

AlienWah.cpp (5235B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   AlienWah.cpp - DPF + Zyn Plugin for AlienWah
      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/Alienwah.h"
     19 
     20 /* ------------------------------------------------------------------------------------------------------------
     21  * AlienWah plugin class */
     22 
     23 class AlienWahPlugin : public AbstractPluginFX<zyn::Alienwah>
     24 {
     25 public:
     26     AlienWahPlugin()
     27         : AbstractPluginFX(11, 4) {}
     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 "AlienWah";
     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', 'a', 'w');
     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;
     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.hints |= kParameterIsAutomable;
     78             parameter.name   = "LFO Frequency";
     79             parameter.symbol = "lfofreq";
     80             parameter.ranges.def = 70.0f;
     81             break;
     82         case 1:
     83             parameter.hints |= kParameterIsAutomable;
     84             parameter.name   = "LFO Randomness";
     85             parameter.symbol = "lforand";
     86             parameter.ranges.def = 0.0f;
     87             break;
     88         case 2:
     89             parameter.hints |= kParameterIsAutomable;
     90             parameter.name   = "LFO Type";
     91             parameter.symbol = "lfotype";
     92             parameter.ranges.def = 0.0f;
     93             parameter.ranges.max = 1.0f;
     94             /*
     95             TODO: support for scalePoints in DPF
     96             scalePoints[0].label = "Sine";
     97             scalePoints[1].label = "Triangle";
     98             scalePoints[0].value = 0.0f;
     99             scalePoints[1].value = 1.0f;
    100             */
    101             break;
    102         case 3:
    103             parameter.hints |= kParameterIsAutomable;
    104             parameter.name   = "LFO Stereo";
    105             parameter.symbol = "lfostereo";
    106             parameter.ranges.def = 62.0f;
    107             break;
    108         case 4:
    109             parameter.hints |= kParameterIsAutomable;
    110             parameter.name   = "Depth";
    111             parameter.symbol = "depth";
    112             parameter.ranges.def = 60.0f;
    113             break;
    114         case 5:
    115             parameter.hints |= kParameterIsAutomable;
    116             parameter.name   = "Feedback";
    117             parameter.symbol = "fb";
    118             parameter.ranges.def = 105.0f;
    119             break;
    120         case 6:
    121             parameter.name   = "Delay";
    122             parameter.symbol = "delay";
    123             parameter.ranges.def = 25.0f;
    124             parameter.ranges.min = 1.0f;
    125             parameter.ranges.max = 100.0f;
    126             break;
    127         case 7:
    128             parameter.hints |= kParameterIsAutomable;
    129             parameter.name   = "L/R Cross";
    130             parameter.symbol = "lrcross";
    131             parameter.ranges.def = 0.0f;
    132             break;
    133         case 8:
    134             parameter.hints |= kParameterIsAutomable;
    135             parameter.name   = "Phase";
    136             parameter.symbol = "phase";
    137             parameter.ranges.def = 64.0f;
    138             break;
    139         }
    140     }
    141 
    142    /**
    143       Set the name of the program @a index.
    144       This function will be called once, shortly after the plugin is created.
    145     */
    146     void initProgramName(uint32_t index, String& programName) noexcept override
    147     {
    148         switch (index)
    149         {
    150         case 0:
    151             programName = "AlienWah 1";
    152             break;
    153         case 1:
    154             programName = "AlienWah 2";
    155             break;
    156         case 2:
    157             programName = "AlienWah 3";
    158             break;
    159         case 3:
    160             programName = "AlienWah 4";
    161             break;
    162         }
    163     }
    164 
    165     DISTRHO_DECLARE_NON_COPY_CLASS(AlienWahPlugin)
    166 };
    167 
    168 /* ------------------------------------------------------------------------------------------------------------
    169  * Create plugin, entry point */
    170 
    171 START_NAMESPACE_DISTRHO
    172 
    173 Plugin* createPlugin()
    174 {
    175     return new AlienWahPlugin();
    176 }
    177 
    178 END_NAMESPACE_DISTRHO