-
Notifications
You must be signed in to change notification settings - Fork 1
/
rtvtchannelwidget.h
122 lines (96 loc) · 3.51 KB
/
rtvtchannelwidget.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#ifndef RTVTCHANNELWIDGET_H
#define RTVTCHANNELWIDGET_H
#include <QWidget>
#include <QtGui>
//#include "rtvtmainwindow.h" // for some parent calls
#include "rtvtcontinuousviewerwidget.h"
#include "rtvtwaveviewerglwidget.h"
// QWT for noise (and other) plots
#ifdef IS_WINDOWS_PC
#ifdef USE_QWT_PLOT
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_scale_engine.h>
#endif
#endif
#ifdef IS_MACOSX
#ifdef USE_QWT_PLOT
#include <qwt/qwt_plot.h>
#include <qwt/qwt_plot_curve.h>
#include <qwt/qwt_plot_grid.h>
#include <qwt/qwt_scale_engine.h>
#endif
#endif
#include "External-Code/fftreal_wrapper.h"
#include "External-Code/utils.h"
#include "universalStructures.h"
class FFTRealWrapper;
// Number of audio samples used to calculate the frequency spectrum
const int SpectrumLengthSamples = PowerOfTwo<FFTLengthPowerOfTwo>::Result;
// Number of bands in the frequency spectrum
const int SpectrumNumBands = 10;
// Lower bound of first band in the spectrum
const qreal SpectrumLowFreq = 0.0; // Hz
// Upper band of last band in the spectrum
const qreal SpectrumHighFreq = 1000.0; // Hz
class RTVTChannelWidget : public QWidget
{
Q_OBJECT;
public:
RTVTChannelWidget(QWidget *parent, int assignedChannel, int assignedWidget, int viewType);
~RTVTChannelWidget();
void play();
void stop();
void resetReadPointer();
void setDrawFromData(bool isDrawing);
void updateNextWriteLocationWithAddition(unsigned int bytesWritten);
void updateNextFilterWriteLocationWithAddition(unsigned int bytesWritten);
unsigned int getNextFilterWriteLocation();
unsigned int getNextWriteLocation();
void updateChannelViews();
int calculateFFTWithLength(unsigned int numberOfAverages, QVector<qreal>& amplitude, QVector<qreal>& frequency);
typedef float DataType;
unsigned char *channelData;
double *filteredChannelData;
float theMean;
QHBoxLayout *horizontalLayout;
RTVTWaveViewerGLWidget *waveViewer;
RTVTContinuousViewerWidget *continuousViewer;
FFTRealWrapper* m_fft;
QVector<float> m_window;
bool isPlaying;
bool usesContinuousView;
unsigned int nextWriteLocation;
unsigned int nextFilterWriteLocation;
unsigned int numberOfChannelsInData;
bool isSelected;
QTimer *channelTimer;
QTimer *viewRedrawTimer;
QLabel *timerValueLabel;
unsigned int channelMSCount;
unsigned int assignedChannel;
unsigned int assignedWidgetNumber;
bool isFiltering;
unsigned int sampleFrameLength;
void keyPressEvent(QKeyEvent *e );
void updateMean(double inMean);
void setNumberOfChannelsInData(int numChannels);
void setChannelSelected(bool status);
void calculateWindow();
void setAddressScheme( unsigned int inWireAddressing );
public slots:
void channelTimeout();
void viewRedrawTimerTimeout();
void childHasWaveformsToWrite(waveformDatum datum);
void childHasEditedTrigger(hoop theTrigger);
void passTriggerUp(hoop theTrigger);
signals:
void waveformsReadyToWrite(void);
void sendTriggerToOtherWaveViewers(hoop theTrigger);
protected:
void resizeEvent (QResizeEvent * event);
void paintEvent(QPaintEvent * event );
void mousePressEvent(QMouseEvent *event);
};
#endif // RTVTCHANNELWIDGET_H