comb.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef _comb_
00008 #define _comb_
00009
00010 #include "denormals.h"
00011
00012
00013
00014
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
00039
00040 inline float comb::process(float input)
00041 {
00042
00043
00044
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