资源简介
基于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 Creator5)
- vtk QT做的三维地质可视化系统2of2
- Qt局域网聊天软件
- Qt Creator opengl实现四元数鼠标控制轨迹
- QT局域网聊天系统(基于QT5.修改过)
- qt-电子点菜系统
- C 餐厅叫号系统(QT平)
- QT 实现文件下载
- qt图像处理
- QT,JPEG解码源代码(已完成)
- Qt 播放音频文件
- Qt 读取16进制的data文件
- MQTT+串口(usart)透传
- 易语言QQTEA算法源码
- VC工程转Qt工程文件的工具
- MQTT推送Demo
- 基于Linux、QT的视频监控系统的设计与
- Qt 百度地图 定位
- QT酷炫界面开发指南《QmlBook》
- Ubuntu下操作Excel,qt代码
- Qt图片浏览器 --基于Qt的Graphics View f
- qtnribbon2破解
- Qt软件开发 完整项目代码
- MQTT_3.1protocol_Specific中文版
- 在QT中使用RTP进行视频的采集和传输
- Mini6410 Qt4和Qtopia编程开发指南
- Qt实现Code39条形码
- qt_ffmpeg_mp4_export_and_import.zip
- QT5.5入门与项目实战
- Huffman Compress 霍夫曼编码 压缩 解压缩
评论
共有 条评论