00001 /***************************************************************************/ 00020 #ifndef AURESERVOIR_DELAYSUM_H__ 00021 #define AURESERVOIR_DELAYSUM_H__ 00022 00023 #include "utilities.h" 00024 #include <complex> 00025 #include <math.h> 00026 #include <fftw3.h> 00027 00028 namespace aureservoir 00029 { 00030 00032 00033 00040 void rfft(const DEVector<double>::Type &x, 00041 CDEVector<double>::Type &X, int fftsize); 00042 00049 void rfft(const DEVector<float>::Type &x, 00050 CDEVector<float>::Type &X, int fftsize); 00051 00057 void irfft(CDEVector<double>::Type &X, DEVector<double>::Type &x); 00058 00064 void irfft(CDEVector<float>::Type &X, DEVector<float>::Type &x); 00065 00067 00072 template <typename T> 00073 class CalcDelay 00074 { 00075 public: 00087 static int gcc(const typename CDEVector<T>::Type &X, 00088 const typename CDEVector<T>::Type &Y, 00089 int maxdelay=1000, int filter=0); 00090 }; 00091 00096 template <typename T> 00097 class DelayLine 00098 { 00099 public: 00100 00101 DelayLine() 00102 { delay_=0; readpt_=1; } 00103 00104 virtual ~DelayLine() {} 00105 00112 void initBuffer(const typename DEVector<T>::Type &initbuf); 00113 00119 T tic(T sample); 00120 00122 const DelayLine& operator= (const DelayLine<T>& src) 00123 { 00124 readpt_ = src.readpt_; 00125 delay_ = src.delay_; 00126 buffer_ = src.buffer_; 00127 return *this; 00128 } 00129 00131 typename DEVector<T>::Type buffer_; 00132 00134 long readpt_; 00135 00137 long delay_; 00138 }; 00139 00140 } // end of namespace aureservoir 00141 00142 #include <aureservoir/delaysum.hpp> 00143 00144 #endif // AURESERVOIR_DELAYSUM_H__