External plugins for 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.

61 lines
1.5KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. Filter.h - Filters, uses analog,formant,etc. filters
  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 FILTER_H
  12. #define FILTER_H
  13. #include "../globals.h"
  14. namespace zyncarla {
  15. class Filter
  16. {
  17. public:
  18. static float getrealfreq(float freqpitch);
  19. static Filter *generate(Allocator &memory, const FilterParams *pars,
  20. unsigned int srate, int bufsize);
  21. Filter(unsigned int srate, int bufsize);
  22. virtual ~Filter() {}
  23. virtual void filterout(float *smp) = 0;
  24. virtual void setfreq(float frequency) = 0;
  25. virtual void setfreq_and_q(float frequency, float q_) = 0;
  26. virtual void setq(float q_) = 0;
  27. virtual void setgain(float dBgain) = 0;
  28. protected:
  29. float outgain;
  30. // current setup
  31. unsigned int samplerate;
  32. int buffersize;
  33. // alias for above terms
  34. float samplerate_f;
  35. float halfsamplerate_f;
  36. float buffersize_f;
  37. int bufferbytes;
  38. inline void alias()
  39. {
  40. samplerate_f = samplerate;
  41. halfsamplerate_f = samplerate_f / 2.0f;
  42. buffersize_f = buffersize;
  43. bufferbytes = buffersize * sizeof(float);
  44. }
  45. };
  46. }
  47. #endif