This project has moved. For the latest updates, please go here.

Changing AudioFileReader.Position while paused caused garbled output

Mar 9, 2016 at 10:46 PM
I am doing MP3 playback using AudioFileReader and WaveOut.

I am able to set AudioFileReader.Position in code while a song is playing, and it works great. The playback jumps to the new position and continues without missing a beat.

However, if I call WaveOut.Pause(), then change AudioFileReader.Position, then call WaveOut.Resume(), the playback resumes, but the output is garbled. If I don't change the position in between the Pause() and Resume(), everything is fine. It's only the specific case of Pause() -> change Position -> Resume() that cause the garbled playback.

Is this a known bug, or am I doing something wrong?

Mar 10, 2016 at 12:31 AM
Try to resume with "WaveOut.Play()" instead of "WaveOut.Resume()". I think this is might be an old WaveOut issue.
Mar 10, 2016 at 1:46 AM
That worked, thanks! What is the difference between those two methods?
Mar 10, 2016 at 11:04 PM
Looking at the source the difference is, that "WaveOut.Resume()" is calling the native restart function without enqueueing buffers like "WaveOut.Play()".