zynaddsubfx

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

Echo.cpp (4130B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   Echo.cpp - DPF + Zyn Plugin for Echo
      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/Echo.h"
     19 
     20 /* ------------------------------------------------------------------------------------------------------------
     21  * Echo plugin class */
     22 
     23 class EchoPlugin : public AbstractPluginFX<zyn::Echo>
     24 {
     25 public:
     26     EchoPlugin()
     27         : AbstractPluginFX(7, 9) {}
     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 "Echo";
     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', 'e', 'c');
     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   = "Delay";
     78             parameter.symbol = "delay";
     79             parameter.ranges.def = 35.0f;
     80             break;
     81         case 1:
     82             parameter.name   = "L/R Delay";
     83             parameter.symbol = "lrdelay";
     84             parameter.ranges.def = 64.0f;
     85             break;
     86         case 2:
     87             parameter.name   = "L/R Cross";
     88             parameter.symbol = "lrcross";
     89             parameter.ranges.def = 30.0f;
     90             break;
     91         case 3:
     92             parameter.name   = "Feedback";
     93             parameter.symbol = "fb";
     94             parameter.ranges.def = 59.0f;
     95             break;
     96         case 4:
     97             parameter.name   = "High Damp";
     98             parameter.symbol = "damp";
     99             parameter.ranges.def = 0.0f;
    100             break;
    101         }
    102     }
    103 
    104    /**
    105       Set the name of the program @a index.
    106       This function will be called once, shortly after the plugin is created.
    107     */
    108     void initProgramName(uint32_t index, String& programName) noexcept override
    109     {
    110         switch (index)
    111         {
    112         case 0:
    113             programName = "Echo 1";
    114             break;
    115         case 1:
    116             programName = "Echo 2";
    117             break;
    118         case 2:
    119             programName = "Echo 3";
    120             break;
    121         case 3:
    122             programName = "Simple Echo";
    123             break;
    124         case 4:
    125             programName = "Canyon";
    126             break;
    127         case 5:
    128             programName = "Panning Echo 1";
    129             break;
    130         case 6:
    131             programName = "Panning Echo 2";
    132             break;
    133         case 7:
    134             programName = "Panning Echo 3";
    135             break;
    136         case 8:
    137             programName = "Feedback Echo";
    138             break;
    139         }
    140     }
    141 
    142     DISTRHO_DECLARE_NON_COPY_CLASS(EchoPlugin)
    143 };
    144 
    145 /* ------------------------------------------------------------------------------------------------------------
    146  * Create plugin, entry point */
    147 
    148 START_NAMESPACE_DISTRHO
    149 
    150 Plugin* createPlugin()
    151 {
    152     return new EchoPlugin();
    153 }
    154 
    155 END_NAMESPACE_DISTRHO