因为在DSPACK里面使用MIC过滤器来获取数据时,它是1秒给你一个数据包,你需要自己来设置包的大小,我给你点参考代码:
var
pmt1, pmt2: PAMMEDIATYPE;
wav1, wav2: TWAVEFORMATEX;
p_Allocator: IMemAllocator;
pProps, tmpProps: TALLOCATORPROPERTIES;
.........................
new(pmt1);
new(pmt2);
wav1.wFormatTag := WAVE_FORMAT_PCM;
wav1.nChannels := 1;
wav1.nSamplesPerSec := 8000;
wav1.nAvgBytesPerSec := 16000;
wav1.nBlockAlign := 2;
wav1.wBitsPerSample := 16;
wav1.cbSize := 2;
CreateAudioMediaType(@wav1, pmt1, true);
if (FilterGraph as IGraphBuilder).ConnectDirect(FindFirstOutputPin(MicFilter), FindPin(AudioMixer, 'Input'), pmt1) <> S_OK then
begin
WriteLog('连接音频调节过滤器失败!', 2);
exit;
end;