00001
00002
00003
00004
00005 #ifndef _GAPE_ACCUMULATOR_H
00006 #define _GAPE_ACCUMULATOR_H
00007
00008 #include "gapeunit.h"
00009 #include <qthread.h>
00010
00023 class GapeAccumulator : public GapeUnit
00024 {
00025 Q_OBJECT
00026
00027 public:
00028
00034 GapeAccumulator(int numSamples);
00035
00039 virtual ~GapeAccumulator();
00040
00041 public slots:
00042
00048 virtual void receiveTick( const GapeFloat* values, int numValues );
00049
00057 virtual void resizeAccumulator( int newSize );
00058
00059 protected:
00060 int spaceRemaining() {
00061 return d_numSamples - d_writeIndex;
00062 }
00063
00064 void adjustBuffers(int newSize);
00065
00066 int d_numSamples;
00067 int d_writeIndex;
00068 GapeFloat* d_samples;
00069 QMutex d_mutex;
00070 bool resizeNeeded;
00071 int resizeSize;
00072 int tickCounter;
00073 };
00074
00075
00076
00077 #endif // _GAPE_ACCUMULATOR