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.

lfshelf2.h 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // ----------------------------------------------------------------------
  2. //
  3. // Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org>
  4. // Modified by falkTX on Jan 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 __LFSHELF2_H
  22. #define __LFSHELF2_H
  23. #include <stdint.h>
  24. #include "global.h"
  25. namespace BLS1 {
  26. class LFshelf2
  27. {
  28. public:
  29. LFshelf2 (void);
  30. ~LFshelf2 (void);
  31. void setfsamp (float fsamp);
  32. void setparam (float g, float f, float s)
  33. {
  34. _f0 = f;
  35. _g0 = g;
  36. _s0 = s;
  37. _touch0++;
  38. }
  39. void reset (void);
  40. void bypass (bool s)
  41. {
  42. if (s != _bypass)
  43. {
  44. _bypass = s;
  45. _touch0++;
  46. }
  47. }
  48. void prepare (int nsamp);
  49. void process (int nsamp, int nchan, float *data[])
  50. {
  51. if (_state != BYPASS) process1 (nsamp, nchan, data);
  52. }
  53. float response (float f);
  54. private:
  55. enum { BYPASS, STATIC, SMOOTH };
  56. void calcpar1 (int nsamp, float g, float f, float s);
  57. void process1 (int nsamp, int nchan, float *data[]);
  58. volatile int16_t _touch0;
  59. volatile int16_t _touch1;
  60. bool _bypass;
  61. int _state;
  62. float _fsamp;
  63. float _g0, _g1;
  64. float _f0, _f1;
  65. float _s0, _s1;
  66. float _a0, _a1, _a2;
  67. float _b1, _b2;
  68. float _da0, _da1, _da2;
  69. float _db1, _db2;
  70. float _z1 [2];
  71. float _z2 [2];
  72. };
  73. }
  74. #endif