-
Notifications
You must be signed in to change notification settings - Fork 0
/
wavfile.h
47 lines (43 loc) · 1.18 KB
/
wavfile.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
#ifndef WAVFILE_H
#define WAVFILE_H
#include <QByteArray>
#include <QFile>
class WAVFILE
{
public:
WAVFILE(QString fileName);
int getFullLength();//获取文件总长度
int getPcmLength();//获取音频数据总程度
int getSampleRate();//获取采样率
int getChannelNumber();//获取通道数
int getBitsWidth();//获取每个样本的位数
QByteArray getPcmData();//获取音频数据
private:
int fileLength;
//RIFF 头
QByteArray riffName;
unsigned long afterRiffLength;
//数据类型标识符
QByteArray wavName;
//格式块
QByteArray fmtName;
unsigned long afterFmtLength;
unsigned short audioFormat;
unsigned short channleNumber;
unsigned long sampleRate;
unsigned long bytesPerSecond;
unsigned short bytesPerSample;
unsigned short bitsPerSample;
//扩展域
unsigned short appendMessage;
QByteArray appendMessageData;
//Fact 块
QByteArray factName;
unsigned long afterFactLength;
QByteArray factData;
//数据块
QByteArray dataName;
unsigned long afterDataLength;
QByteArray pcmData;
};
#endif // WAVFILE_H