diff options
author | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
commit | 8a2c2824a59d7644e13bc52c9a0ecbd641f21f95 (patch) | |
tree | 064ad3f2bf8daab0ad27b128abd86a9bbdb1e496 /muse2/plugins/freeverb/allpass.h | |
parent | a27706d9629e8b592cca4659f865b70adef24e6d (diff) |
new branch muse2, first checkin
Diffstat (limited to 'muse2/plugins/freeverb/allpass.h')
-rw-r--r-- | muse2/plugins/freeverb/allpass.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/muse2/plugins/freeverb/allpass.h b/muse2/plugins/freeverb/allpass.h new file mode 100644 index 00000000..4eb1c1a0 --- /dev/null +++ b/muse2/plugins/freeverb/allpass.h @@ -0,0 +1,50 @@ +// 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; } + }; + + +// Big to inline - but crucial for speed + + +#endif//_allpass |