Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


HevyMetl.h

00001 #ifndef STK_HEVYMETL_H
00002 #define STK_HEVYMETL_H
00003 
00004 #include "FM.h"
00005 
00006 namespace stk {
00007 
00008 /***************************************************/
00036 /***************************************************/
00037 
00038 class HevyMetl : public FM
00039 {
00040  public:
00042 
00045   HevyMetl( void );
00046 
00048   ~HevyMetl( void );
00049 
00051   void noteOn( StkFloat frequency, StkFloat amplitude );
00052 
00054   StkFloat tick( unsigned int channel = 0 );
00055 
00056  protected:
00057 
00058 };
00059 
00060 inline StkFloat HevyMetl :: tick( unsigned int )
00061 {
00062   register StkFloat temp;
00063 
00064   temp = vibrato_.tick() * modDepth_ * 0.2;    
00065   waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
00066   waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
00067   waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
00068   waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
00069     
00070   temp = gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
00071   waves_[1]->addPhaseOffset( temp );
00072     
00073   waves_[3]->addPhaseOffset( twozero_.lastOut() );
00074   temp = (1.0 - (control2_ * 0.5)) * gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
00075   twozero_.tick(temp);
00076     
00077   temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
00078   temp = temp * control1_;
00079     
00080   waves_[0]->addPhaseOffset( temp );
00081   temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
00082     
00083   lastFrame_[0] = temp * 0.5;
00084   return lastFrame_[0];
00085 }
00086 
00087 } // stk namespace
00088 
00089 #endif

The Synthesis ToolKit in C++ (STK)
©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.