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.

89 lines
2.1KB

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