Home   Information   Classes   Download   Usage   Mail List   Requirements   Tutorial


FM.h

00001 /***************************************************/
00024 /***************************************************/
00025 
00026 #if !defined(__FM_H)
00027 #define __FM_H
00028 
00029 #include "Instrmnt.h"
00030 #include "ADSR.h"
00031 #include "WaveLoop.h"
00032 #include "TwoZero.h"
00033 
00034 class FM : public Instrmnt
00035 {
00036  public:
00038   FM( int operators = 4 );
00039 
00041   virtual ~FM();
00042 
00044   void clear();
00045 
00047   void loadWaves(const char **filenames);
00048 
00050   virtual void setFrequency(MY_FLOAT frequency);
00051 
00053   void setRatio(int waveIndex, MY_FLOAT ratio);
00054 
00056   void setGain(int waveIndex, MY_FLOAT gain);
00057 
00059   void setModulationSpeed(MY_FLOAT mSpeed);
00060 
00062   void setModulationDepth(MY_FLOAT mDepth);
00063 
00065   void setControl1(MY_FLOAT cVal);
00066 
00068   void setControl2(MY_FLOAT cVal);
00069 
00071   void keyOn();
00072 
00074   void keyOff();
00075 
00077   void noteOff(MY_FLOAT amplitude);
00078 
00080   virtual MY_FLOAT tick() = 0;
00081 
00083   virtual void controlChange(int number, MY_FLOAT value);
00084 
00085  protected:  
00086   ADSR     **adsr; 
00087   WaveLoop **waves;
00088   WaveLoop *vibrato;
00089   TwoZero  *twozero;
00090   int nOperators;
00091   MY_FLOAT baseFrequency;
00092   MY_FLOAT *ratios;
00093   MY_FLOAT *gains;
00094   MY_FLOAT modDepth;
00095   MY_FLOAT control1;
00096   MY_FLOAT control2;
00097   MY_FLOAT __FM_gains[100];
00098   MY_FLOAT __FM_susLevels[16];
00099   MY_FLOAT __FM_attTimes[32];
00100 
00101 };
00102 
00103 #endif

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