Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.3KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. Resonance.h - Resonance
  4. Copyright (C) 2002-2005 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of version 2 of the GNU General Public License
  8. as published by the Free Software Foundation.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License (version 2 or later) for more details.
  13. You should have received a copy of the GNU General Public License (version 2)
  14. along with this program; if not, write to the Free Software Foundation,
  15. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #ifndef RESONANCE_H
  18. #define RESONANCE_H
  19. #include "../globals.h"
  20. #include "../Misc/Util.h"
  21. #include "../Misc/XMLwrapper.h"
  22. #include "../Params/Presets.h"
  23. #include "../DSP/FFTwrapper.h"
  24. #define N_RES_POINTS 256
  25. class Resonance:public Presets
  26. {
  27. public:
  28. Resonance();
  29. ~Resonance();
  30. void setpoint(int n, unsigned char p);
  31. void applyres(int n, fft_t *fftdata, float freq);
  32. void smooth();
  33. void interpolatepeaks(int type);
  34. void randomize(int type);
  35. void add2XML(XMLwrapper *xml);
  36. void defaults();
  37. void getfromXML(XMLwrapper *xml);
  38. float getfreqpos(float freq);
  39. float getfreqx(float x);
  40. float getfreqresponse(float freq);
  41. float getcenterfreq();
  42. float getoctavesfreq();
  43. void sendcontroller(MidiControllers ctl, float par);
  44. //parameters
  45. unsigned char Penabled; //if the ressonance is enabled
  46. unsigned char Prespoints[N_RES_POINTS]; //how many points define the resonance function
  47. unsigned char PmaxdB; //how many dB the signal may be amplified
  48. unsigned char Pcenterfreq, Poctavesfreq; //the center frequency of the res. func., and the number of octaves
  49. unsigned char Pprotectthefundamental; //the fundamental (1-st harmonic) is not damped, even it resonance function is low
  50. //controllers
  51. float ctlcenter; //center frequency(relative)
  52. float ctlbw; //bandwidth(relative)
  53. private:
  54. };
  55. #endif