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 = undenormalise( buffer[bufidx] ); 00036 00037 output = -input + bufout; 00038 buffer[bufidx] = input + (bufout*feedback); 00039 00040 if(++bufidx>=bufsize) bufidx = 0; 00041 00042 return output; 00043 } 00044 00045 #endif//_allpass 00046 00047 //ends
1.5.6