Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# Rhodey.h

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

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