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.

pareq.h 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // ----------------------------------------------------------------------
  2. //
  3. // Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org>
  4. // Modified by falkTX on Jan-Apr 2015 for inclusion in Carla
  5. //
  6. // This program is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU General Public License as published by
  8. // the Free Software Foundation; either version 2 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // This program is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with this program; if not, write to the Free Software
  18. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. //
  20. // ----------------------------------------------------------------------
  21. #ifndef __PAREQ_H
  22. #define __PAREQ_H
  23. #include <stdint.h>
  24. #include <math.h>
  25. #include "global.h"
  26. namespace REV1 {
  27. class Pareq
  28. {
  29. public:
  30. Pareq (void);
  31. ~Pareq (void);
  32. void setfsamp (float fsamp);
  33. void setparam (float f, float g)
  34. {
  35. _f0 = f;
  36. _g0 = powf (10.0f, 0.05f * g);
  37. _touch0++;
  38. }
  39. void reset (void);
  40. void prepare (int nsamp);
  41. void process (int nsamp, int nchan, float *data[])
  42. {
  43. if (_state != BYPASS) process1 (nsamp, nchan, data);
  44. }
  45. private:
  46. enum { BYPASS, STATIC, SMOOTH, MAXCH = 4 };
  47. void calcpar1 (int nsamp, float g, float f);
  48. void process1 (int nsamp, int nchan, float *data[]);
  49. volatile int16_t _touch0;
  50. volatile int16_t _touch1;
  51. bool _bypass;
  52. int _state;
  53. float _fsamp;
  54. float _g0, _g1;
  55. float _f0, _f1;
  56. float _c1, _dc1;
  57. float _c2, _dc2;
  58. float _gg, _dgg;
  59. float _z1 [MAXCH];
  60. float _z2 [MAXCH];
  61. };
  62. }
  63. #endif