SweepVF.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. SweepVF.h
  3. Copyright 2004-7 Tim Goetze <tim@quitte.de>
  4. http://quitte.de/dsp/
  5. SweepVFI, a lorenz fractal modulating the cutoff frequency of a
  6. state-variable (ladder) filter.
  7. SweepVFII, the same with Q being modulated by a second fractal.
  8. AutoWah, SVF being modulated by 'instant' amplitude (envelope).
  9. */
  10. /*
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU General Public License for more details.
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the Free Software
  21. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  22. 02111-1307, USA or point your web browser to http://www.gnu.org.
  23. */
  24. #ifndef _SWEEP_VF_H_
  25. #define _SWEEP_VF_H_
  26. #include "dsp/SVF.h"
  27. #include "dsp/Lorenz.h"
  28. #include "dsp/Roessler.h"
  29. #include "dsp/RMS.h"
  30. #include "dsp/BiQuad.h"
  31. #include "dsp/OnePole.h"
  32. class SweepVFI
  33. : public Plugin
  34. {
  35. public:
  36. double fs;
  37. /* svf parameters */
  38. sample_t f, Q;
  39. /* needs to be a power of two */
  40. enum {
  41. BLOCK_SIZE = 32
  42. };
  43. DSP::StackedSVF<1,2> svf;
  44. DSP::Lorenz lorenz;
  45. template <sample_func_t F>
  46. void one_cycle (int frames);
  47. public:
  48. static PortInfo port_info [];
  49. void init();
  50. void activate();
  51. void run (int n)
  52. {
  53. one_cycle<store_func> (n);
  54. }
  55. void run_adding (int n)
  56. {
  57. one_cycle<adding_func> (n);
  58. }
  59. };
  60. class SweepVFII
  61. : public Plugin
  62. {
  63. public:
  64. /* svf parameters */
  65. sample_t f, Q;
  66. /* needs to be a power of two */
  67. enum {
  68. BLOCK_SIZE = 32
  69. };
  70. DSP::StackedSVF<1,2> svf;
  71. DSP::Lorenz lorenz1;
  72. DSP::Lorenz lorenz2;
  73. template <sample_func_t F>
  74. void one_cycle (int frames);
  75. public:
  76. static PortInfo port_info [];
  77. void init();
  78. void activate();
  79. void run (int n)
  80. {
  81. one_cycle<store_func> (n);
  82. }
  83. void run_adding (int n)
  84. {
  85. one_cycle<adding_func> (n);
  86. }
  87. };
  88. /* //////////////////////////////////////////////////////////////////////// */
  89. class AutoWah
  90. : public Plugin
  91. {
  92. public:
  93. double fs;
  94. /* svf parameters */
  95. sample_t f, Q;
  96. /* needs to be a power of two */
  97. enum {
  98. BLOCK_SIZE = 32
  99. };
  100. DSP::StackedSVF<1,2> svf;
  101. DSP::RMS rms;
  102. DSP::BiQuad filter;
  103. DSP::OnePoleHP hp;
  104. template <sample_func_t F>
  105. void one_cycle (int frames);
  106. public:
  107. static PortInfo port_info [];
  108. void init();
  109. void activate();
  110. void run (int n)
  111. {
  112. one_cycle<store_func> (n);
  113. }
  114. void run_adding (int n)
  115. {
  116. one_cycle<adding_func> (n);
  117. }
  118. };
  119. #endif /* _SWEEP_VF_H_ */