home *** CD-ROM | disk | FTP | other *** search
/ PC Musician 2000 / PC_Musician_2000.iso / PCMUSIC / NOTATION / SILENCE / FM4OP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  1.8 KB  |  60 lines

  1. /*******************************************/
  2. /*  Master Class for 4 Operator FM Synth   */
  3. /*  by Perry R. Cook, 1995-96              */ 
  4. /*  This instrument contains an 4 waves,   */
  5. /*  4 envelopes, and various state vars.   */
  6. /*                                         */
  7. /*  The basic Chowning/Stanford FM patent  */
  8. /*  expired April 1995, but there exist    */
  9. /*  follow-on patents, mostly assigned to  */
  10. /*  Yamaha.  If you are of the type who    */
  11. /*  should worry about this (making money) */
  12. /*  worry away.                            */
  13. /*                                         */
  14. /*******************************************/
  15.  
  16. #if !defined(__FM4Op_h)
  17. #define __FM4Op_h
  18.  
  19. #include "Instrmnt.h"
  20. #include "ADSR.h"
  21. #include "RawLoop.h"
  22. #include "TwoZero.h"
  23.  
  24. class FM4Op : public Instrmnt
  25. {
  26.   protected:  
  27.     ADSR    *adsr[4]; 
  28.     RawLoop *waves[4];
  29.     RawLoop *vibWave;
  30.     TwoZero *twozero;
  31.     MY_FLOAT baseFreq;
  32.     MY_FLOAT ratios[4];
  33.     MY_FLOAT gains[4];
  34.     MY_FLOAT modDepth;
  35.     MY_FLOAT control1;
  36.     MY_FLOAT control2;
  37.     MY_FLOAT __FM4Op_gains[100];
  38.     MY_FLOAT __FM4Op_susLevels[16];
  39.     MY_FLOAT __FM4Op_attTimes[32];
  40.   public:
  41.     FM4Op();
  42.     ~FM4Op();
  43.     void loadWaves(char* wave1, char* wave2, char* wave3, char* wave4);
  44.     void clear();
  45.     void setFreq(MY_FLOAT frequency);
  46.     void setRatio(int whichOne, MY_FLOAT ratio);
  47.     void setGain(int whichOne, MY_FLOAT gain);
  48.     void keyOn();
  49.     void keyOff();
  50.     void noteOff(MY_FLOAT amp);
  51.     /*  There's no tick() method here, because that depends on the algorithm  */
  52.     void setModulationSpeed(MY_FLOAT mSpeed);
  53.     void setModulationDepth(MY_FLOAT mDepth);
  54.     void setControl1(MY_FLOAT cVal);
  55.     void setControl2(MY_FLOAT cVal);
  56.     virtual void controlChange(int number, MY_FLOAT value);
  57. };
  58.  
  59. #endif
  60.