使用 RIFF header fmt 是数据子块的数据数组的大小。
BUFFER_SIZE = DSC.Subchunk2Size / (FCD_PCM.NumOfChan * (FCD_PCM.bitsPerSample / 8));
如果我使用以下代码读取标题
WORD CWav::Read_Header(FILE* WAVF) {
//Checking For PCM TRUE/FALSE
fseek(WAVF, 48, SEEK_SET);
int16_t num_bytes_in_ext;
fread(&num_bytes_in_ext, sizeof int16_t, 1, WAVF);
if (PCM == true) {
char Data[5] = "data";
fread(&DSC, 1, sizeof(DATA_SUB_CHUNCK), WAVF);
if (memcmp(DSC.Subchunk2ID, Data, sizeof(DSC.Subchunk2ID)) != 0) {
fseek(WAVF, 78, SEEK_SET);
fread(&DSC, 1, sizeof(DATA_SUB_CHUNCK), WAVF);
}
while (memcmp(DSC.Subchunk2ID, Data, sizeof(DSC.Subchunk2ID)) != 0) {
fseek(WAVF, DSCSeek++, SEEK_SET);
fread(&DSC, 1, sizeof(DATA_SUB_CHUNCK), WAVF);
}
}