00001 //GapeUnit.h 00002 //Dave Chisholm dkc@ccrma.stanford.edu 00003 //11/20/00 00004 #ifndef _GAPE_UNIT_H 00005 #define _GAPE_UNIT_H 00006 00007 #include <math.h> //for power and log10 functions 00008 #include "gapeconsts.h" 00009 #include <qthread.h> 00010 //#include "object.h" // from STK for type GapeFloat 00011 class GapeController; 00012 class GapeUnitGroup; 00013 00014 //#include "gapeunitgroup.h" 00015 00062 class GapeUnit : public QObject 00063 { 00064 Q_OBJECT 00065 00066 public: 00067 00071 // GapeUnit();// = NULL); 00072 00073 00078 // GapeUnit(GapeController* c);// = NULL); 00079 00085 GapeUnit(GapeController* c = NULL, int nChannels = 1); 00086 00090 virtual ~GapeUnit(); 00091 00092 00093 public slots: 00094 00101 virtual void receiveTick(const GapeFloat* values, int numValues) = 0; 00102 00107 virtual void setFreq(double f); 00108 00113 virtual void setGain(double g); 00114 00119 virtual void setGainDb(double g); 00120 00125 virtual GapeFloat getFreq() const; 00126 00131 virtual GapeFloat getGain() const; 00132 00137 virtual GapeFloat getGainDb() const; 00138 00143 virtual void setMute(bool b); 00144 00149 virtual void setSolo(bool b); 00150 00155 virtual bool getMute() const; 00156 00161 virtual bool getSolo() const; 00162 00167 virtual GapeUnitGroup* getParent() const; 00168 00175 virtual void setParent(GapeUnitGroup* p); 00176 00181 virtual GapeController** getControllers() const; 00182 00187 virtual void addController(GapeController* c); 00188 00189 00195 virtual void removeController(GapeController* c); 00196 00197 00202 virtual void setNumChannels(int n); 00203 00208 virtual int getNumChannels() const; 00209 00214 virtual int getNumControllers() const; 00215 00216 00221 virtual bool isGraphical (); 00222 00223 signals: 00229 void emitTick(const GapeFloat* values, int numValues); 00230 void emitFreq(double f); 00231 void emitGain(double g); 00232 void emitGainDb(double g); 00233 void emitMute(bool b); 00234 void emitSolo(bool b); 00235 void emitNumChannels(int n); 00236 00237 protected: 00238 GapeController** controllers; 00239 GapeUnitGroup* parent; 00240 bool muted, solo;// destroyController; 00241 GapeFloat gain, frequency; 00242 int numChannels, numControllers, controllerCapacity; 00243 QMutex updateMutex; 00244 00249 virtual void setupControls(GapeController* c); 00250 00256 virtual void disconnectControls(GapeController* c); 00257 }; 00258 00259 #endif