NAudio - 缓冲区满后

时间:2014-05-19 10:42:39

标签: c# .net audio signal-processing naudio

我正在尝试使用C#中的NAudio创建音频环回,我不断收到此消息:

  

NAudio.MmException未处理

     

AlreadyAllocated调用waveInOpen

这是我的代码:

if (lstDevices.SelectedItems.Count == 0) return;

int deviceNumber = lstDevices.SelectedItems[0].Index;

sourceStream = new NAudio.Wave.WaveIn();
sourceStream.DeviceNumber = deviceNumber;
sourceStream.WaveFormat = new NAudio.Wave.WaveFormat(44100, NAudio.Wave.WaveIn.GetCapabilities(deviceNumber).Channels);

NAudio.Wave.WaveInProvider waveIn = new NAudio.Wave.WaveInProvider(sourceStream);

waveOut = new NAudio.Wave.DirectSoundOut();
waveOut.Init(waveIn);

sourceStream.StartRecording();
waveOut.Play();

我很难过。有没有人有任何想法?

0 个答案:

没有答案