MediaFoundationReader在播放录制的.wav文件时抛出异常

时间:2015-11-05 16:36:19

标签: c# naudio

基本上我记录了我的扬声器上听到的内容

speakersWaveIn = new WasapiLoopbackCapture(); //class variable
waveFileWriter = new WaveFileWriter(filepath, speakersWaveIn.WaveFormat); //class variable
speakersWaveIn.DataAvailable += speakersWaveIn_DataAvailable;
speakersWaveIn.RecordingStopped += speakersWaveIn_RecordingStopped;
speakersWaveIn.StartRecording();

speakersWaveIn_DataAvailable

waveFileWriter.Write(e.Buffer, 0, e.BytesRecorded);
waveFileWriter.Flush();

并按键

speakersWaveIn.StopRecording();
waveFileWriter.Dispose();

完美无缺。我可以使用Windows Media Player播放生成的wav.-文件。

但是,尝试通过

播放文件时
MediaFoundationReader reader = new MediaFoundationReader(filePath);

我得到System.Runtime.InteropServices.COMException: HRESULT: 0xC00D5212

0 个答案:

没有答案