Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
00001 #ifndef STK_RESONATE_H 00002 #define STK_RESONATE_H 00003 00004 #include "Instrmnt.h" 00005 #include "ADSR.h" 00006 #include "BiQuad.h" 00007 #include "Noise.h" 00008 00009 namespace stk { 00010 00011 /***************************************************/ 00028 /***************************************************/ 00029 00030 class Resonate : public Instrmnt 00031 { 00032 public: 00034 Resonate( void ); 00035 00037 ~Resonate( void ); 00038 00040 void clear( void ); 00041 00043 void setResonance( StkFloat frequency, StkFloat radius ); 00044 00046 void setNotch( StkFloat frequency, StkFloat radius ); 00047 00049 void setEqualGainZeroes( void ) { filter_.setEqualGainZeroes(); }; 00050 00052 void keyOn( void ) { adsr_.keyOn(); }; 00053 00055 void keyOff( void ) { adsr_.keyOff(); }; 00056 00058 void noteOn( StkFloat frequency, StkFloat amplitude ); 00059 00061 void noteOff( StkFloat amplitude ); 00062 00064 void controlChange( int number, StkFloat value ); 00065 00067 StkFloat tick( unsigned int channel = 0 ); 00068 00069 protected: 00070 00071 ADSR adsr_; 00072 BiQuad filter_; 00073 Noise noise_; 00074 StkFloat poleFrequency_; 00075 StkFloat poleRadius_; 00076 StkFloat zeroFrequency_; 00077 StkFloat zeroRadius_; 00078 00079 }; 00080 00081 inline StkFloat Resonate :: tick( unsigned int ) 00082 { 00083 lastFrame_[0] = filter_.tick( noise_.tick() ); 00084 lastFrame_[0] *= adsr_.tick(); 00085 return lastFrame_[0]; 00086 } 00087 00088 } // stk namespace 00089 00090 #endif
The Synthesis ToolKit in C++ (STK) |
©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved. |