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