I\'m using the naudio lib in C# and want to play a simple file. The problem is, the playback stops after 1 second. I cant figure out the reason why it does that.
<
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()