Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
00001 #ifndef STK_PLUCKED_H 00002 #define STK_PLUCKED_H 00003 00004 #include "Instrmnt.h" 00005 #include "DelayA.h" 00006 #include "OneZero.h" 00007 #include "OnePole.h" 00008 #include "Noise.h" 00009 00010 namespace stk { 00011 00012 /***************************************************/ 00029 /***************************************************/ 00030 00031 class Plucked : public Instrmnt 00032 { 00033 public: 00035 Plucked( StkFloat lowestFrequency ); 00036 00038 ~Plucked( void ); 00039 00041 void clear( void ); 00042 00044 void setFrequency( StkFloat frequency ); 00045 00047 void pluck( StkFloat amplitude ); 00048 00050 void noteOn( StkFloat frequency, StkFloat amplitude ); 00051 00053 void noteOff( StkFloat amplitude ); 00054 00056 StkFloat tick( unsigned int channel = 0 ); 00057 00058 protected: 00059 00060 DelayA delayLine_; 00061 OneZero loopFilter_; 00062 OnePole pickFilter_; 00063 Noise noise_; 00064 StkFloat loopGain_; 00065 unsigned long length_; 00066 00067 }; 00068 00069 inline StkFloat Plucked :: tick( unsigned int ) 00070 { 00071 // Here's the whole inner loop of the instrument!! 00072 return lastFrame_[0] = 3.0 * delayLine_.tick( loopFilter_.tick( delayLine_.lastOut() * loopGain_ ) ); 00073 } 00074 00075 } // stk namespace 00076 00077 #endif 00078
The Synthesis ToolKit in C++ (STK) |
©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved. |