r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / plugins / freeverb / Components / allpass.hpp
blob35e56e718b31f47f9cfac2f8839f3b17b716eaf1
1 // Allpass filter declaration
2 //
3 // Written by Jezar at Dreampoint, June 2000
4 // http://www.dreampoint.co.uk
5 // This code is public domain
7 #ifndef _allpass_
8 #define _allpass_
9 #include "denormals.h"
11 class allpass
13 public:
14 allpass();
15 void setbuffer(float *buf, int size);
16 inline float process(float inp);
17 void mute();
18 void setfeedback(float val);
19 float getfeedback();
20 // private:
21 float feedback;
22 float *buffer;
23 int bufsize;
24 int bufidx;
28 // Big to inline - but crucial for speed
30 inline float allpass::process(float input)
32 float output;
33 float bufout;
35 bufout = buffer[bufidx];
36 undenormalise(bufout);
38 output = -input + bufout;
39 buffer[bufidx] = input + (bufout*feedback);
41 if(++bufidx>=bufsize) bufidx = 0;
43 return output;
46 #endif//_allpass
48 //ends