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.

Resonance.h 2.1KB

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