-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.h
148 lines (117 loc) · 3.42 KB
/
mainwindow.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QEvent>
#include <QObject>
#include <QCloseEvent>
#include <QAudioBuffer>
#include <QLabel>
#include <QElapsedTimer>
#include <QSlider>
#include <QProgressBar>
#include <settings/appsettings.h>
#include <settings/chartsettingsdialog.h>
#include <settings/processsettingsdialog.h>
#include <settings/recordersettingsdialog.h>
#include <capturedata/recorder.h>
#include <logo/logo_structs.h>
#include <logo/logo_preprocessing.h>
#include <logo/logo_sta.h>
#include <logo/logo_util.h>
#include <customwidget/aboutapp.h>
#include "qcustomplot.h"
#define BUFFER_TIME 0.04
#define BUFFER_TIME_MS 40
//#define DEBUG
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void setDefaultLanguage(QString fileName);
void changeEvent(QEvent *event);
protected:
void closeEvent(QCloseEvent *event);
private slots:
void save();
void open();
void print();
void exit();
void record();
void processTools();
void recordTools();
void chartTools();
void aboutApp();
void toggleFullScreen();
void changeView();
void process(const QAudioBuffer &buffer);
void showStatusMessage(const QString &mess);
void restartPlot();
void play();
void fileLoaded(const bool &state);
#ifdef DEBUG
void exportDebugData();
#endif
void showChartContexMenu(const QPoint &pos);
void overView();
void preview(QPrinter *printer);
void setLevelThreShold(const int &value);
void setTolerance(const int &value);
void estimateLevels();
void updateSpectrogramChart();
void changeLanguage();
private:
Ui::MainWindow *ui;
void connectGUI();
void saveSettings();
void loadSettings();
void loadComponents();
void loadProcessingComponents();
void refreshCharts();
void configureCharts();
void normalizeSpectrogram();
void shortTimeAnalysis();
void frequencyAnalysis();
void changeRecorderButtonIcon();
void checkRecorderStatus();
void matrixToData();
// Status bar
QLabel* _folderName;
QElapsedTimer* _timer;
qlonglong _elapsedTime;
QProgressBar* _progressBar;
// Record audio
Recorder* _recorder;
// Settings Dialog
AppSettings* _appSettings;
RecorderSettingsDialog* _recordSettingsDialog;
ProcessSettingsDialog* _procSettingsDialog;
ChartSettingsDialog* _chartSettingsDialog;
AboutApp* _aboutAppDialog;
// Chart
QCPGraph* _energyPlot;
QCPGraph* _pitchPlot;
QCPColorScale* _spectrogramScale;
QCPColorMap* _spectrogramPlot;
// Logo Library
logo_data _data;
logo_slicer _slicer;
logo_freq_analyzer _freq;
logo_pitch _pitch;
logo_vector _tempBuffer;
#ifdef Q_OS_UNIX
int _tempBufferCount;
#endif
bool _fileLoaded;
QTranslator* translator;
#ifdef DEBUG
QList<logo_vector> _framesRecord;
QList<logo_vector> _rifBufferFrames;
QList<logo_matrix> _windowSlicer;
#endif
};
#endif // MAINWINDOW_H