Playing a .wav file using naudio, playback stops after 1 sec

允我心安 提交于 2019-12-01 18:15:07

You need to make sure you are using function callbacks if you are trying to play audio from a console app, since the default for WaveOut is to use window callbacks.

new WaveOut(WaveCallbackInfo.FunctionCallback())

Update: With newer versions of NAudio I now recommend that you avoid function callbacks, as they can cause deadlocks with certain drivers. Instead, WaveOutEvent which uses event callbacks and a background thread is the preferred mechanism:

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