diff options
author | Robert Jonsson <spamatica@gmail.com> | 2009-12-27 11:30:35 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2009-12-27 11:30:35 +0000 |
commit | b703eab295330e6f81564fbb39a10a1a2fdd2f54 (patch) | |
tree | e46b5c9a6bc22fd661c15d1d2123f5bf631cef80 /muse_qt4_evolution/plugins/freeverb/allpass.h | |
parent | 5d5fa0fdf913907edbc3d2d29a7548f0cb658c94 (diff) |
moved old qt4 branch
Diffstat (limited to 'muse_qt4_evolution/plugins/freeverb/allpass.h')
-rw-r--r-- | muse_qt4_evolution/plugins/freeverb/allpass.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/muse_qt4_evolution/plugins/freeverb/allpass.h b/muse_qt4_evolution/plugins/freeverb/allpass.h new file mode 100644 index 00000000..2f27691e --- /dev/null +++ b/muse_qt4_evolution/plugins/freeverb/allpass.h @@ -0,0 +1,47 @@ +// Allpass filter declaration +// +// Written by Jezar at Dreampoint, June 2000 +// http://www.dreampoint.co.uk +// This code is public domain + +#ifndef _allpass_ +#define _allpass_ +#include "denormals.h" + +//--------------------------------------------------------- +// allpass +//--------------------------------------------------------- + +class allpass + { + float feedback; + float *buffer; + int bufsize; + int bufidx; + + public: + allpass() { bufidx = 0; } + void setbuffer(float *buf, int size) { + buffer = buf; + bufsize = size; + } + float process(float input) { + float bufout = buffer[bufidx]; + undenormalise(bufout); + float output = -input + bufout; + buffer[bufidx] = input + (bufout*feedback); + if (++bufidx >= bufsize) + bufidx = 0; +// bufidx = ++bufidx % bufsize; + return output; + } + void mute() { + for (int i=0; i<bufsize; i++) + buffer[i]=0; + } + void setfeedback(float val) { feedback = val; } + float getfeedback() { return feedback; } + }; + + +#endif//_allpass |