waveOutOpen
waveOutPrepareHeader
waveOutWrite
waveOutReset
waveOutUnprepareHeader
waveOutClose
还要处理两个结构:
//假设采样率为 11025, 8比特, 单声道
WAVEFORMATEX _WaveFormatEx;
_WaveFormatEx.wFormatTag = WAVE_FORMAT_PCM;
_WaveFormatEx.nSamplesPerSec = 11025;
_WaveFormatEx.nAvgBytesPerSec= 11025;
_WaveFormatEx.nChannels = 1;
_WaveFormatEx.wBitsPerSample = 8;
_WaveFormatEx.nBlockAlign = (_WaveFormatEx.wBitsPerSample>>3)*_WaveFormatEx.nChannels;
//.wav 文件的结构:
#pragma pack(push,1)
typedef struct
{
unsigned char FileMark[4]; //00H 4 必须为 "RIFF"
unsigned long FileSizeS8; //04H 4 FileSize - 8
unsigned char WaveMark[4]; //08H 4 必须为 "WAVE"
unsigned char ckID[4]; //0CH 4 "fmt\x20"
unsigned long nChunkSize; //10H 4 WAV文件块尺寸 (16 = 10H)
unsigned short wFormatTag; //14H 2 格式类别 (01H为PCM形式的声音数据)
unsigned short nChannels; //16H 2 通道数,单声道为1,双声道为2
unsigned long nSamplesPerSec; //18H 4 采样率 11025, 22050, 44100
unsigned long nAvgBytesPerSec;//1CH 4 波形音频数据传送速率,其值为通道数×每秒数据位数×每样本的数据位数/8
unsigned short nBlockAlign; //20H 2 数据块的调整数(按字节算的),其值为通道数×每样本的数据位值/8
unsigned short nBitsPerSample; //22H 2 每样本的数据位数,8, 16
unsigned char DataMark[4]; //24H 4 必须为 "DATA"
unsigned long DataSize; //28H 4 声音数据的长度 <= FileSize - 44
} TWaveFileHead;
#pragma pack(pop)
TWaveFileHead 后面紧接着就是 DataSize 个字节的声音数据,再往后有可能有一些软件和版权信息等,不需要处理。
知道这些,再看帮助就容易了。
--------------------next---------------------
阅读(1032) | 评论(0) | 转发(0) |