资源简介
基于Qt4.5的一个频谱绘制源码,下载后编译,运行即可
代码片段和文件信息
/***************************************************************************
* Copyright (C) 2008 - Giuseppe Cigala *
* g_cigala@virgilio.it *
* *
* 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. *
* 59 Temple Place - Suite 330 Boston MA 02111-1307 USA. *
***************************************************************************/
#include “qfreq.h“
QFreq::QFreq(QWidget *parent) : QWidget(parent)
{
initValue();
initColor();
}
void QFreq::initValue()
{
start_point = 0;
zoom_point = ((1024/2)+1)*20000/22050;
freq1 = 0;
freq2 = 5;
freq3 = 10;
freq4 = 15;
freq5 = 20;
range_freq = 20;
typeFFT = 0;
lockFFT = false;
}
void QFreq::initColor()
{
colLin = Qt::black;
colLog = Qt::black;
col512 = Qt::black;
col1024 = Qt::black;
col2048 = Qt::black;
col4096 = Qt::black;
colLock = Qt::red;
}
void QFreq::setZoomPoint(int N)
{
zoom_point = ((N/2)+1)*20000/22050;
}
void QFreq::calculateFFT(int N)
{
/*
QFile file (“test.wav“);
if (!file.open(QIODevice::ReadOnly))
return;
char *data;
file.read(data N);
for (i =0; i <=N; i++)
{
in[i] = (double)data[i];
i++;
}
*/
double *in;
double *out;
fftw_plan plan;
double A[N];
magnitudeLin = 0;
magnitudeLog = 0;
min_val_lin = 5000000;
max_val_lin = -1000;
min_val_log = 5000000;
max_val_log = -1000;
int is16bitfile = 1;
int val val2;
char inc[N];
FILE *infile;
const char * fileName = wavFile.toLatin1().data();
infile = fopen(fileName “r“);
// skip wav file header
fgets(inc37infile);
fgets(inc9infile);
// read data and fill “A“-array
for (int v=0; v {
val = fgetc(infile);
if (is16bitfile)
{
val2 = f
- 上一篇:ACS 5.2 license
- 下一篇:一个用Qt来绘制虚拟仪器仪表
相关资源
- 一个用Qt来绘制虚拟仪器仪表
- Linux上Qt-OpenCV采集摄像头视频并显示
- Qt-detect-Udisk老外写的qt检测U盘
- 基于qt的udp发送文字信息聊天小软件
- QT实现图像处理-傅立叶变换、傅立叶
- Qt小-记事本notepad
- OpenCV利用Qt的GUI显示图片
- SpringBoot+ActiveMq+MQTT实现消息的发送和
- MuyiGaoDeMap
- QT5在ARM 平台的移植过程
- qt聊天气泡
- QT初学者手动界面代码实现简单运算的
- 基于OpenCV3.2+Qt5.8的basler相机硬件触发
- Qt mqtt通信
-
QMediaPla
yer多窗口播放视频 - Qt使用vlc库播放视频
- 计算器图形化界面Qt版
- QT自定义精美换肤界面转
- QT5 简易多媒体播放器
- QT使用样式表进行界面美化
- QT的QSS教程
- 大恒相机QT例程LINUX
- QT的简要界面设计的一个
- 基于 qt的gstreamer 应用,
- 基于QT的网络聊天室+收发数据及文件
- QT 不规则悬浮球 仿360
- qt数据画波形
- qt 实现ftp服务器源码
- VTK应用之VTK与Qt整合的
- qt实现的滑动设置时间自定义控件
评论
共有 条评论