-
Notifications
You must be signed in to change notification settings - Fork 7
/
fftscope.h
67 lines (51 loc) · 1020 Bytes
/
fftscope.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
class FFTScope;
#ifndef FFTSCOPE_H
#define FFTSCOPE_H
#include <qwidget.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qlayout.h>
#include <qtimer.h>
#include <comedilib.h>
#include <fcntl.h>
#include <fftw3.h>
#include <qwt/qwt_plot.h>
#include <qwt/qwt_plot_curve.h>
#include <QMainWindow>
#include "comedirecord.h"
#define FFT_UPDATE_DELAY 1000
#define FFT_BUFFER_SIZE 1024
class FFTScope : public QMainWindow
{
Q_OBJECT
public:
/**
* Constructor:
**/
FFTScope( ComediRecord * parent , int fft_buffer_size = FFT_BUFFER_SIZE);
~FFTScope();
public:
int append(double);
int getBufferSize() {return buffer_size;};
private:
int filled;
int current_entry;
int buffer_size;
QTimer *counter;
private slots:
/**
* Updates the time-code and also the voltages of the channels
**/
void updateFFT();
private:
int rate;
double *in;
fftw_complex *out;
QwtPlot *fftPlot;
QwtPlotCurve *fftCurve;
ComediRecord *comedirecord;
double *x;
double *y;
int nFreqSamples;
};
#endif