00001 // 00002 // KarplusString.h -- the simplest possible "physical model" string class 00003 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT 00004 // 00005 00006 /* TODO: 00007 Jorge . . . November 2005 00008 1) Add a dump() function. 00009 2) implement exceptions 00010 3) add DEBUG print code. 00011 4) make it scalable . . . 00012 5) allow for dynamic frequency . . . ? do we want that? 00013 6) add a trigger function . . . (do we need an envelope?) 00014 */ 00015 00016 00017 #ifndef CSL_KARPLUSSTRING_H 00018 #define CSL_KARPLUSSTRING_H 00019 00020 #include "CSL_Core.h" // my superclass 00021 //#include "RingBuffer.h" 00022 //#include "Filters.h" 00023 #include "Noise.h" 00024 00025 namespace csl { // my namespace 00026 00030 00031 class KarplusString : public UnitGenerator, public Scalable, public Phased { 00032 00033 public: 00034 KarplusString(); 00035 KarplusString(float frequency); 00036 void setFrequency(float frequency); 00037 void trigger(); 00038 void dump(); 00039 00040 void nextBuffer(Buffer &outputBuffer, unsigned outBufNum) throw (CException); 00041 virtual bool isActive() { return (mEnergy > 0); }; 00042 00043 Buffer mDelayLine; 00044 00045 protected: 00046 void initDelayLine(); 00047 unsigned mIndex; 00048 unsigned mDelayLength; 00049 unsigned mEnergy; 00050 float mFrequency; 00051 00052 }; // end of class 00053 00054 } // end of namespace 00055 00056 #endif 00057
1.4.5-20051010