Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# TubeBell.h

    00001 #ifndef STK_TUBEBELL_H
    00002 #define STK_TUBEBELL_H
    00003
    00004 #include "FM.h"
    00005
    00006 namespace stk {
    00007
    00008 /***************************************************/
    00038 /***************************************************/
    00039
    00040 class TubeBell : public FM
    00041 {
    00042  public:
    00044
    00047   TubeBell( void );
    00048
    00050   ~TubeBell( void );
    00051
    00053   void noteOn( StkFloat frequency, StkFloat amplitude );
    00054
    00056   StkFloat tick( unsigned int channel = 0 );
    00057
    00058  protected:
    00059
    00060 };
    00061
    00062 inline StkFloat TubeBell :: tick( unsigned int )
    00063 {
    00064   StkFloat temp, temp2;
    00065
    00066   temp = gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
    00067   temp = temp * control1_;
    00068
    00069   waves_[0]->addPhaseOffset( temp );
    00070   waves_[3]->addPhaseOffset( twozero_.lastOut() );
    00071   temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
    00072   twozero_.tick( temp );
    00073
    00074   waves_[2]->addPhaseOffset( temp );
    00075   temp = ( 1.0 - (control2_ * 0.5)) * gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
    00076   temp += control2_ * 0.5 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
    00077
    00078   // Calculate amplitude modulation and apply it to output.
    00079   temp2 = vibrato_.tick() * modDepth_;
    00080   temp = temp * (1.0 + temp2);
    00081
    00082   lastFrame_[0] = temp * 0.5;
    00083   return lastFrame_[0];
    00084 }
    00085
    00086 } // stk namespace
    00087
    00088 #endif

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