数据源的缓冲设为多大最好,中间格式的数据缓冲与源数据缓冲大小的关系是什么,目标格式的数据缓冲是否可设成2:3的大小关系。目前我一次从wav文件中读4096字节大小送入源数据缓冲中,再把中间格式的数据缓冲大小也尝试着设为4096字节,初步转换成功,然后,我再把目标格式数据缓冲设为4096*3/2,准备acmStreamPrepareHeader时mmr为0,通过,可是在最后的一步acmStreamConvert却报告mmr为8 ,不知是何错误?应作何修改呢?我的源数据是PCM格式,操作系统自带录音机录的,目标格式是G723.1
是不是你的目标格式数据缓冲设置得不对啊,要根据两种格式的WAVEFORMATEX来换算,类似这样:DWORD dwDst2Bytes = pwfDrv->nAvgBytesPerSec * dwDst1Samples /
pwfPCM->nSamplesPerSec;
dwDst2Bytes = dwDst2Bytes * 3 / 2; // 增加一点空间
#define MMSYSERR_NOTSUPPORTED (MMSYSERR_BASE + 8) /* function isn't supported */
该函数不被支持?
wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels;
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
wBitsPerSample
Bits per sample for the wFormatTag format type. If wFormatTag is WAVE_FORMAT_PCM, then wBitsPerSample should be equal to 8 or 16. For non-PCM formats, this member must be set according to the manufacturer's specification of the format tag. Note that some compression schemes cannot define a value for wBitsPerSample, so this member can be zero. 也就是说,对于某些CODEC(G723.1),必须根据厂商的格式标签的规格进行设置