comb.hpp

Go to the documentation of this file.
00001 // Comb filter class declaration
00002 //
00003 // Written by Jezar at Dreampoint, June 2000
00004 // http://www.dreampoint.co.uk
00005 // This code is public domain
00006 
00007 #ifndef _comb_
00008 #define _comb_
00009 
00010 #include "denormals.h"
00011 
00012 /**
00013 * Combination filter
00014 *Takes multiple audio channels and mix them for one ear
00015 */
00016 class comb
00017 {
00018 public:
00019     comb();
00020     void    setbuffer(float *buf, int size);
00021     inline  float    process(float inp);
00022     void    mute();
00023     void    setdamp(float val);
00024     float    getdamp();
00025     void    setfeedback(float val);
00026     float    getfeedback();
00027 private:
00028     float    feedback;
00029     float    filterstore;
00030     float    damp1;
00031     float    damp2;
00032     float    *buffer;
00033     int    bufsize;
00034     int    bufidx;
00035 };
00036 
00037 
00038 // Big to inline - but crucial for speed
00039 
00040 inline float comb::process(float input)
00041 {
00042 /* FIXME
00043 * comb::process is not really ear-friendly the tunning values must
00044 * be changed*/
00045     float output;
00046 
00047     output = undenormalise( buffer[bufidx] );
00048 
00049     filterstore = undenormalise(output*damp2);
00050 
00051     buffer[bufidx] = input + filterstore*feedback;
00052 
00053     if(++bufidx>=bufsize) bufidx = 0;
00054 
00055     return output;
00056 }
00057 
00058 #endif //_comb_
00059 
00060 //ends

Generated on Tue May 25 08:04:53 2010 for VLC by  doxygen 1.5.6