Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
00001 #ifndef STK_BEETHREE_H 00002 #define STK_BEETHREE_H 00003 00004 #include "FM.h" 00005 00006 namespace stk { 00007 00008 /***************************************************/ 00040 /***************************************************/ 00041 00042 class BeeThree : public FM 00043 { 00044 public: 00046 00049 BeeThree( void ); 00050 00052 ~BeeThree( void ); 00053 00055 void noteOn( StkFloat frequency, StkFloat amplitude ); 00056 00058 StkFloat tick( unsigned int channel = 0 ); 00059 00060 protected: 00061 00062 }; 00063 00064 inline StkFloat BeeThree :: tick( unsigned int ) 00065 { 00066 register StkFloat temp; 00067 00068 if ( modDepth_ > 0.0 ) { 00069 temp = 1.0 + ( modDepth_ * vibrato_.tick() * 0.1 ); 00070 waves_[0]->setFrequency( baseFrequency_ * temp * ratios_[0] ); 00071 waves_[1]->setFrequency( baseFrequency_ * temp * ratios_[1] ); 00072 waves_[2]->setFrequency( baseFrequency_ * temp * ratios_[2] ); 00073 waves_[3]->setFrequency( baseFrequency_ * temp * ratios_[3] ); 00074 } 00075 00076 waves_[3]->addPhaseOffset( twozero_.lastOut() ); 00077 temp = control1_ * 2.0 * gains_[3] * adsr_[3]->tick() * waves_[3]->tick(); 00078 twozero_.tick( temp ); 00079 00080 temp += control2_ * 2.0 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick(); 00081 temp += gains_[1] * adsr_[1]->tick() * waves_[1]->tick(); 00082 temp += gains_[0] * adsr_[0]->tick() * waves_[0]->tick(); 00083 00084 lastFrame_[0] = temp * 0.125; 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. |