InvalidParameter calling waveOutOpen MmException

梦想与她 提交于 2019-12-02 18:24:23

问题


This code works on 32bit Windows XP but on 64bit Windows 7 it raises an exception. (on any CPU configuration)

var format = NAudio.Wave.WaveFormat.CreateCustomFormat(
    WaveFormatEncoding.Pcm, 8000, 1, 16000, 1, 16)
BufferedWaveProvider myBufferedWaveProvider = new BufferedWaveProvider(format);
myWaveOut.Init(myBufferedWaveProvider);

Any help?


回答1:


You've created an invalid WaveFormat. PCM 8kHz mono 16 bit (which is what you seem to be trying to make) has a block align of 2. There's an easier way to make this WaveFormat in NAudio:

new WaveFormat(8000, 1);


来源:https://stackoverflow.com/questions/22126148/invalidparameter-calling-waveoutopen-mmexception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!