r105: This commit was manufactured by cvs2svn to create tag
[cinelerra_cv/mob.git] / hvirtual / plugins / freeverb / Components / comb.hpp
blobb852c4e87ffbc21566a6d0cae60803017f5e7f25
1 // Comb filter class declaration
2 //
3 // Written by Jezar at Dreampoint, June 2000
4 // http://www.dreampoint.co.uk
5 // This code is public domain
7 #ifndef _comb_
8 #define _comb_
10 #include "denormals.h"
12 class comb
14 public:
15 comb();
16 void setbuffer(float *buf, int size);
17 inline float process(float inp);
18 void mute();
19 void setdamp(float val);
20 float getdamp();
21 void setfeedback(float val);
22 float getfeedback();
23 private:
24 float feedback;
25 float filterstore;
26 float damp1;
27 float damp2;
28 float *buffer;
29 int bufsize;
30 int bufidx;
34 // Big to inline - but crucial for speed
36 inline float comb::process(float input)
38 float output;
40 output = buffer[bufidx];
41 undenormalise(output);
43 filterstore = (output*damp2) + (filterstore*damp1);
44 undenormalise(filterstore);
46 buffer[bufidx] = input + (filterstore*feedback);
48 if(++bufidx>=bufsize) bufidx = 0;
50 return output;
53 #endif //_comb_
55 //ends