00001 // 00002 // DelayLine.h -- an Interpolating Delay Line 00003 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT 00004 // 00005 // This is a typical circular buffer with one writer and multiple readers (tap instances) 00006 00007 #ifndef CSL_DelayLine_H 00008 #define CSL_DelayLine_H 00009 00010 #include "CSL_Core.h" 00011 #include "RingBuffer.h" 00012 00013 namespace csl { 00014 00015 // The delay line takes its input and write a delayed output 00016 class DelayLine : public UnitGenerator, public Effect { 00017 public: 00018 DelayLine(unsigned maxDelayInSamples); 00019 00020 float delayTime(); 00021 unsigned delayLength(); 00022 00023 float setDelayTime(float delayInMiliseconds); 00024 unsigned setDelayLength(unsigned delayInSamples); 00025 // void setInterpolationKind(); 00026 00027 void nextBuffer(Buffer &output) throw(CException); 00028 00029 protected: 00030 RingBuffer mRingBuffer; 00031 unsigned mMaxDelayInSamples; 00032 unsigned mTotalDelayInSamples; 00033 00034 }; 00035 00036 } 00037 00038 #endif 00039 00040 //typedef enum { 00041 // kTruncate, 00042 // kLinear, 00043 // kAllPass 00044 //} InterpType; 00045 // 00046 //class DLine : public FrameStream, public Processor { 00047 // 00048 //private: 00049 // Buffer ring_buffer; 00050 // 00051 // float max_delay_time; 00052 // float delay_time; 00053 // float target_delay_time; 00054 // unsigned max_delay_in_frames; 00055 // InterpType interp_type; 00056 // unsigned start_frame; 00058 // unsigned write_frame; 00059 // 00060 //public: 00061 // DLine( FrameStream &input, float max_delay ); 00062 // ~DLine(); 00063 // 00064 // bool set_target_delay_time( float tdt ); 00065 // bool init_delay_time( float dt ); 00066 // bool set_interp_type( InterpType ); 00068 // 00069 // status mono_next_buffer(Buffer & inputBuffer, Buffer & outputBuffer, unsigned inBufNum, unsigned outBufNum); 00070 // status next_buffer(Buffer & inputBuffer, Buffer & outputBuffer); 00071 // 00072 //};
1.4.5-20051010