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.

65 lines
2.0KB

  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
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10. */
  11. #ifndef RESONANCE_H
  12. #define RESONANCE_H
  13. #include "../globals.h"
  14. #include "../Misc/Util.h"
  15. #include "../Misc/XMLwrapper.h"
  16. #include "../Params/Presets.h"
  17. #include "../DSP/FFTwrapper.h"
  18. #define N_RES_POINTS 256
  19. class Resonance:public Presets
  20. {
  21. public:
  22. Resonance(void);
  23. ~Resonance(void);
  24. void setpoint(int n, unsigned char p);
  25. void applyres(int n, fft_t *fftdata, float freq) const;
  26. void smooth(void);
  27. void interpolatepeaks(int type);
  28. void randomize(int type);
  29. void zero(void);
  30. void paste(Resonance &r);
  31. void add2XML(XMLwrapper& xml);
  32. void defaults(void);
  33. void getfromXML(XMLwrapper& xml);
  34. //TODO remove unused methods
  35. float getfreqpos(float freq) const;
  36. float getfreqx(float x) const;
  37. float getfreqresponse(float freq) const;
  38. float getcenterfreq(void) const;
  39. float getoctavesfreq(void) const;
  40. void sendcontroller(MidiControllers ctl, float par);
  41. //parameters
  42. unsigned char Penabled; //if the ressonance is enabled
  43. unsigned char Prespoints[N_RES_POINTS]; //how many points define the resonance function
  44. unsigned char PmaxdB; //how many dB the signal may be amplified
  45. unsigned char Pcenterfreq, Poctavesfreq; //the center frequency of the res. func., and the number of octaves
  46. unsigned char Pprotectthefundamental; //the fundamental (1-st harmonic) is not damped, even it resonance function is low
  47. //controllers
  48. float ctlcenter; //center frequency(relative)
  49. float ctlbw; //bandwidth(relative)
  50. static const rtosc::Ports ports;
  51. };
  52. #endif