The Synthesis ToolKit in C++ (STK)

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
    00092
    00099   virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
    00100
    00101  protected:
    00102
    00103   std::vector<ADSR *> adsr_;
    00104   std::vector<FileLoop *> waves_;
    00105   SineWave vibrato_;
    00106   TwoZero  twozero_;
    00107   unsigned int nOperators_;
    00108   StkFloat baseFrequency_;
    00109   std::vector<StkFloat> ratios_;
    00110   std::vector<StkFloat> gains_;
    00111   StkFloat modDepth_;
    00112   StkFloat control1_;
    00113   StkFloat control2_;
    00114   StkFloat fmGains_[100];
    00115   StkFloat fmSusLevels_[16];
    00116   StkFloat fmAttTimes_[32];
    00117
    00118 };
    00119
    00120 } // stk namespace
    00121
    00122 #endif

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