Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# FM.h

    00001 #ifndef STK_FM_H
    00002 #define STK_FM_H
    00003
    00004 #include "Instrmnt.h"
    00005 #include "ADSR.h"
    00006 #include "FileLoop.h"
    00007 #include "SineWave.h"
    00008 #include "TwoZero.h"
    00009
    00010 namespace stk {
    00011
    00012 /***************************************************/
    00035 /***************************************************/
    00036
    00037 class FM : public Instrmnt
    00038 {
    00039  public:
    00041
    00044   FM( unsigned int operators = 4 );
    00045
    00047   virtual ~FM( void );
    00048
    00050   void clear( void );
    00051
    00053   void loadWaves( const char **filenames );
    00054
    00056   virtual void setFrequency( StkFloat frequency );
    00057
    00059   void setRatio( unsigned int waveIndex, StkFloat ratio );
    00060
    00062   void setGain( unsigned int waveIndex, StkFloat gain );
    00063
    00065   void setModulationSpeed( StkFloat mSpeed ) { vibrato_.setFrequency( mSpeed ); };
    00066
    00068   void setModulationDepth( StkFloat mDepth ) { modDepth_ = mDepth; };
    00069
    00071   void setControl1( StkFloat cVal ) { control1_ = cVal * 2.0; };
    00072
    00074   void setControl2( StkFloat cVal ) { control2_ = cVal * 2.0; };
    00075
    00077   void keyOn( void );
    00078
    00080   void keyOff( void );
    00081
    00083   void noteOff( StkFloat amplitude );
    00084
    00086   virtual void controlChange( int number, StkFloat value );
    00087
    00089   virtual StkFloat tick( unsigned int ) = 0;
    00090
    00091  protected:
    00092
    00093   std::vector<ADSR *> adsr_;
    00094   std::vector<FileLoop *> waves_;
    00095   SineWave vibrato_;
    00096   TwoZero  twozero_;
    00097   unsigned int nOperators_;
    00098   StkFloat baseFrequency_;
    00099   std::vector<StkFloat> ratios_;
    00100   std::vector<StkFloat> gains_;
    00101   StkFloat modDepth_;
    00102   StkFloat control1_;
    00103   StkFloat control2_;
    00104   StkFloat fmGains_[100];
    00105   StkFloat fmSusLevels_[16];
    00106   StkFloat fmAttTimes_[32];
    00107
    00108 };
    00109
    00110 } // stk namespace
    00111
    00112 #endif

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