Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   Tutorial


Voicer.h

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 
00121 protected:
00122 
00123   typedef struct {
00124     Instrmnt *instrument;
00125     long tag;
00126     MY_FLOAT noteNumber;
00127     MY_FLOAT frequency;
00128     int sounding;
00129     int channel;
00130   } Voice;
00131 
00132   int  nVoices;
00133   int maxVoices;
00134   Voice *voices;
00135   long tags;
00136   int muteTime;
00137   MY_FLOAT lastOutput;
00138 
00139 };
00140 
00141 #endif

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