Workaround spatializer bugs.
[vlc/davidf-public.git] / modules / audio_filter / spatializer / comb.hpp
blob71d4ef070e6045be287ee4b711415f6efa557484
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)
39 #if 1
40 /* FIXME FIXME FIXME
41 * comb::process is completly broken so ignore it for now */
42 return 0.0;
44 #else
45 float output;
47 output = undenormalise( buffer[bufidx] );
49 filterstore = undenormalise( output*damp2 + filterstore*damp1 );
51 buffer[bufidx] = input + filterstore*feedback;
53 if(++bufidx>=bufsize) bufidx = 0;
55 return output;
56 #endif
59 #endif //_comb_
61 //ends