00001 // Allpass filter 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 _allpass_ 00008 #define _allpass_ 00009 #include "denormals.h" 00010 00011 class allpass 00012 { 00013 public: 00014 allpass(); 00015 void setbuffer(float *buf, int size); 00016 inline float process(float inp); 00017 void mute(); 00018 void setfeedback(float val); 00019 float getfeedback(); 00020 // private: 00021 float feedback; 00022 float *buffer; 00023 int bufsize; 00024 int bufidx; 00025 }; 00026 00027 00028 // Big to inline - but crucial for speed 00029 00030 inline float allpass::process(float input) 00031 { 00032 float output; 00033 float bufout; 00034 00035 bufout = buffer[bufidx]; 00036 undenormalise(bufout); 00037 00038 output = -input + bufout; 00039 buffer[bufidx] = input + (bufout*feedback); 00040 00041 if(++bufidx>=bufsize) bufidx = 0; 00042 00043 return output; 00044 } 00045 00046 #endif//_allpass 00047 00048 //ends 00049 00050 00051 00052 00053
1.5.5