Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
00001 /***************************************************/ 00030 /***************************************************/ 00031 00032 #ifndef STK_VOICER_H 00033 #define STK_VOICER_H 00034 00035 #include "Instrmnt.h" 00036 #include <vector> 00037 00038 class Voicer : public Stk 00039 { 00040 public: 00042 Voicer( StkFloat 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( StkFloat noteNumber, StkFloat amplitude, int channel=0 ); 00072 00074 00077 void noteOff( StkFloat noteNumber, StkFloat amplitude, int channel=0 ); 00078 00080 00083 void noteOff( long tag, StkFloat amplitude ); 00084 00086 00089 void setFrequency( StkFloat noteNumber, int channel=0 ); 00090 00092 00095 void setFrequency( long tag, StkFloat noteNumber ); 00096 00098 void pitchBend( StkFloat value, int channel=0 ); 00099 00101 void pitchBend( long tag, StkFloat value ); 00102 00104 void controlChange( int number, StkFloat value, int channel=0 ); 00105 00107 void controlChange( long tag, int number, StkFloat value ); 00108 00110 void silence( void ); 00111 00113 StkFloat tick(); 00114 00116 StkFloat *tick(StkFloat *vector, unsigned int vectorSize); 00117 00119 00125 virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 ); 00126 00128 StkFloat lastOut() const; 00129 00131 StkFloat lastOutLeft() const; 00132 00134 StkFloat lastOutRight() const; 00135 00136 protected: 00137 00138 struct Voice { 00139 Instrmnt *instrument; 00140 long tag; 00141 StkFloat noteNumber; 00142 StkFloat frequency; 00143 int sounding; 00144 int channel; 00145 00146 // Default constructor. 00147 Voice() 00148 :instrument(0), tag(0), noteNumber(-1.0), frequency(0.0), 00149 sounding(0), channel(0) {} 00150 }; 00151 00152 std::vector<Voice> voices_; 00153 long tags_; 00154 int muteTime_; 00155 StkFloat lastOutput_; 00156 StkFloat lastOutputLeft_; 00157 StkFloat lastOutputRight_; 00158 }; 00159 00160 #endif
The Synthesis ToolKit in C++ (STK) |
©1995-2007 Perry R. Cook and Gary P. Scavone. All Rights Reserved. |