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.

74 lines
2.5KB

  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(void);
  29. ~Resonance(void);
  30. void setpoint(int n, unsigned char p);
  31. void applyres(int n, fft_t *fftdata, float freq) const;
  32. void smooth(void);
  33. void interpolatepeaks(int type);
  34. void randomize(int type);
  35. void zero(void);
  36. void paste(Resonance &r);
  37. void add2XML(XMLwrapper& xml);
  38. void defaults(void);
  39. void getfromXML(XMLwrapper& xml);
  40. //TODO remove unused methods
  41. float getfreqpos(float freq) const;
  42. float getfreqx(float x) const;
  43. float getfreqresponse(float freq) const;
  44. float getcenterfreq(void) const;
  45. float getoctavesfreq(void) const;
  46. void sendcontroller(MidiControllers ctl, float par);
  47. //parameters
  48. unsigned char Penabled; //if the ressonance is enabled
  49. unsigned char Prespoints[N_RES_POINTS]; //how many points define the resonance function
  50. unsigned char PmaxdB; //how many dB the signal may be amplified
  51. unsigned char Pcenterfreq, Poctavesfreq; //the center frequency of the res. func., and the number of octaves
  52. unsigned char Pprotectthefundamental; //the fundamental (1-st harmonic) is not damped, even it resonance function is low
  53. //controllers
  54. float ctlcenter; //center frequency(relative)
  55. float ctlbw; //bandwidth(relative)
  56. static const rtosc::Ports ports;
  57. };
  58. #endif