zynaddsubfx

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

Resonance.h (2125B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   Resonance.h - Resonance
      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 #ifndef RESONANCE_H
     14 #define RESONANCE_H
     15 
     16 #include "../globals.h"
     17 #include "../Misc/Util.h"
     18 #include "../Misc/XMLwrapper.h"
     19 #include "../Params/Presets.h"
     20 #include "../DSP/FFTwrapper.h"
     21 
     22 #define N_RES_POINTS 256
     23 
     24 namespace zyn {
     25 
     26 class Resonance:public Presets
     27 {
     28     public:
     29         Resonance(void);
     30         ~Resonance(void) override;
     31         void setpoint(int n, unsigned char p);
     32         void applyres(int n, fft_t *fftdata, float freq) const;
     33         void smooth(void);
     34         void interpolatepeaks(int type);
     35         void randomize(int type);
     36         void zero(void);
     37 
     38         void paste(Resonance &r);
     39         void add2XML(XMLwrapper& xml) override;
     40         void defaults(void);
     41         void getfromXML(XMLwrapper& xml);
     42 
     43 
     44         //TODO remove unused methods
     45         float getfreqpos(float freq) const;
     46         float getfreqx(float x) const;
     47         float getfreqresponse(float freq) const;
     48         float getcenterfreq(void) const;
     49         float getoctavesfreq(void) const;
     50         void sendcontroller(MidiControllers ctl, float par);
     51 
     52         //parameters
     53         unsigned char Penabled;     //if the ressonance is enabled
     54         unsigned char Prespoints[N_RES_POINTS]; //how many points define the resonance function
     55         unsigned char PmaxdB;       //how many dB the signal may be amplified
     56         unsigned char Pcenterfreq, Poctavesfreq; //the center frequency of the res. func., and the number of octaves
     57         unsigned char Pprotectthefundamental;   //the fundamental (1-st harmonic) is not damped, even it resonance function is low
     58 
     59         //controllers
     60         float ctlcenter; //center frequency(relative)
     61         float ctlbw; //bandwidth(relative)
     62 
     63         static const rtosc::Ports ports;
     64 };
     65 
     66 }
     67 
     68 #endif