Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# Simple.h

    00001 #ifndef STK_SIMPLE_H
    00002 #define STK_SIMPLE_H
    00003
    00004 #include "Instrmnt.h"
    00005 #include "ADSR.h"
    00006 #include "FileLoop.h"
    00007 #include "OnePole.h"
    00008 #include "BiQuad.h"
    00009 #include "Noise.h"
    00010
    00011 namespace stk {
    00012
    00013 /***************************************************/
    00030 /***************************************************/
    00031
    00032 class Simple : public Instrmnt
    00033 {
    00034  public:
    00036
    00039   Simple( void );
    00040
    00042   ~Simple( void );
    00043
    00045   void clear( void );
    00046
    00048   void setFrequency( StkFloat frequency );
    00049
    00051   void keyOn( void );
    00052
    00054   void keyOff( void );
    00055
    00057   void noteOn( StkFloat frequency, StkFloat amplitude );
    00058
    00060   void noteOff( StkFloat amplitude );
    00061
    00063   void controlChange( int number, StkFloat value );
    00064
    00066   StkFloat tick( unsigned int channel = 0 );
    00067
    00068  protected:
    00069
    00070   ADSR      adsr_;
    00071   FileLoop *loop_;
    00072   OnePole   filter_;
    00073   BiQuad    biquad_;
    00074   Noise     noise_;
    00075   StkFloat  baseFrequency_;
    00076   StkFloat  loopGain_;
    00077
    00078 };
    00079
    00080 inline StkFloat Simple :: tick( unsigned int )
    00081 {
    00082   lastFrame_[0] = loopGain_ * loop_->tick();
    00083   biquad_.tick( noise_.tick() );
    00084   lastFrame_[0] += (1.0 - loopGain_) * biquad_.lastOut();
    00085   lastFrame_[0] = filter_.tick( lastFrame_[0] );
    00086   lastFrame_[0] *= adsr_.tick();
    00087   return lastFrame_[0];
    00088 }
    00089
    00090 } // stk namespace
    00091
    00092 #endif

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