Home Information Classes Download Usage Mail List Requirements Links Tutorial
00001 /***************************************************/ 00030 /***************************************************/ 00031 00032 #if !defined(__VOICER_H) 00033 #define __VOICER_H 00034 00035 #include "Stk.h" 00036 #include "Instrmnt.h" 00037 00038 class Voicer : public Stk 00039 { 00040 public: 00042 Voicer( int maxInstruments, MY_FLOAT decayTime=0.2 ); 00043 00045 ~Voicer(); 00046 00048 00052 void addInstrument( Instrmnt *instrument, int channel=0 ); 00053 00055 00060 void removeInstrument( Instrmnt *instrument ); 00061 00063 00071 long noteOn( MY_FLOAT noteNumber, MY_FLOAT amplitude, int channel=0 ); 00072 00074 00077 void noteOff( MY_FLOAT noteNumber, MY_FLOAT amplitude, int channel=0 ); 00078 00080 00083 void noteOff( long tag, MY_FLOAT amplitude ); 00084 00086 00089 void setFrequency( MY_FLOAT noteNumber, int channel=0 ); 00090 00092 00095 void setFrequency( long tag, MY_FLOAT noteNumber ); 00096 00098 void pitchBend( MY_FLOAT value, int channel=0 ); 00099 00101 void pitchBend( long tag, MY_FLOAT value ); 00102 00104 void controlChange( int number, MY_FLOAT value, int channel=0 ); 00105 00107 void controlChange( long tag, int number, MY_FLOAT value ); 00108 00110 void silence( void ); 00111 00113 MY_FLOAT tick(); 00114 00116 MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize); 00117 00119 MY_FLOAT lastOut() const; 00120 00122 MY_FLOAT lastOutLeft() const; 00123 00125 MY_FLOAT lastOutRight() const; 00126 00127 protected: 00128 00129 typedef struct { 00130 Instrmnt *instrument; 00131 long tag; 00132 MY_FLOAT noteNumber; 00133 MY_FLOAT frequency; 00134 int sounding; 00135 int channel; 00136 } Voice; 00137 00138 int nVoices; 00139 int maxVoices; 00140 Voice *voices; 00141 long tags; 00142 int muteTime; 00143 MY_FLOAT lastOutput; 00144 MY_FLOAT lastOutputLeft; 00145 MY_FLOAT lastOutputRight; 00146 }; 00147 00148 #endif
The Synthesis ToolKit in C++ (STK) |
©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved. |