00001 #ifndef _PERIODIC_RESPONSE_CURVE_H_ 00002 #define _PERIODIC_RESPONSE_CURVE_H_ 00003 00004 00005 #include "AbstractFunction.h" 00006 #include "Utils.h" 00007 00015 template <class T, unsigned int n> 00016 class PeriodicResponseCurve: public AbstractFunction<T> 00017 { 00018 public: 00029 PeriodicResponseCurve(T inputMin, T inputMax, T outputSamples[n]); 00030 00031 00051 T operator()(const T input) const; 00052 00057 inline T getInputMin() const; 00058 00063 inline T getInputMax() const; 00064 00065 private: 00066 ResponseCurve<T, n> mResponseCurve; 00067 00068 }; 00069 00070 template <class T, unsigned int n> 00071 PeriodicResponseCurve<T, n>::PeriodicResponseCurve(T inputMin, T inputMax, T outputSamples[n]): 00072 mResponseCurve(inputMin, inputMax, outputSamples) 00073 {} 00074 00075 template <class T, unsigned int n> 00076 T PeriodicResponseCurve<T, n>::operator() (const T input) const 00077 { 00078 T inputInRange = mod(input, getInputMin(), getInputMax()); 00079 00080 return mResponseCurve(inputInRange); 00081 } 00082 00083 template <class T, unsigned int n> 00084 T PeriodicResponseCurve<T, n>::getInputMin() const 00085 { 00086 return mResponseCurve.getInputMin(); 00087 } 00088 00089 template <class T, unsigned int n> 00090 T PeriodicResponseCurve<T, n>::getInputMax() const 00091 { 00092 return mResponseCurve.getInputMax(); 00093 } 00094 00095 #endif