PlayerFlat
 Tudo Classes Funções
fftcalc.h
1 #ifndef FFTCALC_H
2 #define FFTCALC_H
3 
4 #include <QThread>
5 #include <QWaitCondition>
6 #include <QMutex>
7 #include <QVector>
8 #include <QDebug>
9 #include <QTimer>
10 #include <QObject>
11 #include "fft.h"
12 
13 // the size of fft array that is dispatched to
14 // mainwindow
15 #define SPECSIZE 512
16 
17 class BufferProcessor: public QObject
18 {
19  Q_OBJECT
20  QVector<double> array;
21  QVector<double> window;
22  QVector<double> spectrum;
23  QVector<double> logscale;
24  QTimer *timer;
25  bool compressed, running, iscalc;
26  int chunks, interval, pass;
27  CArray complexFrame;
28 public slots:
29  void processBuffer(QVector<double> _array, int duration);
30 signals:
31  void calculatedSpectrum(QVector<double> spectrum);
32  void allDone(void);
33 protected slots:
34  void run();
35 public:
36  explicit BufferProcessor(QObject *parent=0);
37  ~BufferProcessor();
38  void calc(QVector<double> &_array, int duration);
39 };
40 
41 // fftcalc runs in a separate thread
42 class FFTCalc : public QObject{
43  Q_OBJECT
44 private:
45  bool isBusy;
46  BufferProcessor processor;
47  QThread processorThread;
48 
49 public:
50  explicit FFTCalc(QObject *parent = 0);
51  ~FFTCalc();
52  void calc(QVector<double> &_array, int duration);
53 public slots:
54  void setSpectrum(QVector<double> spectrum);
55  void freeCalc();
56 signals:
57  void calculatedSpectrum(QVector<double> spectrum);
58 };
59 
60 #endif // FFTCALC_H
Definition: fftcalc.h:42
Definition: fftcalc.h:17