-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathSpectroGraph.h
98 lines (83 loc) · 2.75 KB
/
SpectroGraph.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
/***************************************************************************
* Copyright (C) 2012-2015 Highway-9 Studio. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* CUIT Highway-9 Studio, China. *
***************************************************************************/
/*!
* \file Spectrograph.h
* \author chengxuan [email protected]
* \date 2015-02-03
* \brief 频谱绘制头文件。
* \version 3.0.0
*
* \verbatim
* 历史
* 3.0.0 创建,
* 2015-02-03 by chengxuan
*
* \endverbatim
*
*/
#ifndef SPECTROGRAPH_H
#define SPECTROGRAPH_H
/*! \def SPECTROGRAPH_VERSION
* 版本控制宏,对应v3.0.0版本.
*/
#define SPECTROGRAPH_VERSION 0x030000
#include <QLabel>
#include <QString>
#include <vector>
using namespace std;
class QPaintEvent;
QT_FORWARD_DECLARE_CLASS(QMouseEvent)
/*! 频谱绘制
*/
class Spectrograph : public QLabel
{
Q_OBJECT
public:
/*! 构造函数
* \param parent 父窗口指针,默认为NULL
*/
Spectrograph(QWidget *parent = NULL);
/*! 析构函数.*/
~Spectrograph();
public:
/*! 设置参数
* \param lowFreq 频谱下界
* \param highFreq 频谱上节
*/
void setParams(const double &lowFreq, const double &highFreq);
/*! 重置频谱
*/
void reset();
protected:
/*! 虚函数,重新实现paintEvent函数
* \param event QPaintEvent类型
*/
virtual void paintEvent(QPaintEvent *event);
public slots:
/*! 频谱数据改变
* \param vecFrequency 频谱数据
*/
void handleSpectrumChanged(const vector<float> &vecFrequency);
private:
double m_lowFreq; /*!< 频谱下界*/
double m_highFreq; /*!< 频谱上界*/
vector<float> m_vecFrequency; /*!< 通过快速傅里叶变换传过来的参数*/
};
#endif // SPECTROGRAPH_H