zynaddsubfx

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

Echo.h (2793B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   Echo.h - Echo Effect
      5   Copyright (C) 2002-2005 Nasca Octavian Paul
      6   Author: Nasca Octavian Paul
      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 #ifndef ECHO_H
     15 #define ECHO_H
     16 
     17 #include "Effect.h"
     18 #include "../Misc/Stereo.h"
     19 
     20 namespace zyn {
     21 
     22 /**Echo Effect*/
     23 class Echo final:public Effect
     24 {
     25     public:
     26         Echo(EffectParams pars);
     27         ~Echo();
     28 
     29         void out(const Stereo<float *> &input);
     30         unsigned char getpresetpar(unsigned char npreset, unsigned int npar);
     31         void setpreset(unsigned char npreset);
     32         /**
     33          * Sets the value of the chosen variable
     34          *
     35          * The possible parameters are:
     36          *   -# Volume
     37          *   -# Panning
     38          *   -# Delay
     39          *   -# L/R Delay
     40          *   -# L/R Crossover
     41          *   -# Feedback
     42          *   -# Dampening
     43          * @param npar number of chosen parameter
     44          * @param value the new value
     45          */
     46         void changepar(int npar, unsigned char value);
     47 
     48         /**
     49          * Gets the specified parameter
     50          *
     51          * The possible parameters are
     52          *   -# Volume
     53          *   -# Panning
     54          *   -# Delay
     55          *   -# L/R Delay
     56          *   -# L/R Crossover
     57          *   -# Feedback
     58          *   -# Dampening
     59          * @param npar number of chosen parameter
     60          * @return value of parameter
     61          */
     62         unsigned char getpar(int npar) const;
     63         int getnumparams(void);
     64         void cleanup(void);
     65 
     66         static rtosc::Ports ports;
     67     private:
     68         //Parameters
     69         unsigned char Pvolume;  /**<#1 Volume or Dry/Wetness*/
     70         unsigned char Pdelay;   /**<#3 Delay of the Echo*/
     71         unsigned char Plrdelay; /**<#4 L/R delay difference*/
     72         unsigned char Pfb;      /**<#6Feedback*/
     73         unsigned char Phidamp;  /**<#7Dampening of the Echo*/
     74 
     75         void setvolume(unsigned char _Pvolume);
     76         void setdelay(unsigned char _Pdelay);
     77         void setlrdelay(unsigned char _Plrdelay);
     78         void setfb(unsigned char _Pfb);
     79         void sethidamp(unsigned char _Phidamp);
     80 
     81         //Real Parameters
     82         float fb, hidamp;
     83         //Left/Right delay lengths
     84         Stereo<int> delayTime;
     85         float       lrdelay;
     86         float       avgDelay;
     87 
     88         void initdelays(void);
     89         //2 channel ring buffer
     90         Stereo<float *> delay;
     91         Stereo<float>   old;
     92 
     93         //position of reading/writing from delaysample
     94         Stereo<int> pos;
     95         //step size for delay buffer
     96         Stereo<int> delta;
     97         Stereo<int> ndelta;
     98 };
     99 
    100 }
    101 
    102 #endif