Dec 30, 2010 at 12:17 PM
Edited Dec 30, 2010 at 12:18 PM
I wrote an enhanced version of BufferedWaveProvider, but I encountered the same problem you are facing.
Basically, the BufferedWaveProvider has an upper limit on the number of buffers it is holding.
It is a typical producer-consumer problem.
If you produce too many buffers, then the consumer (BufferedWaveProvider) can't hold them.
You could change it to a higher value, but it is not really a good solution as (1) it might still break (2) it wastes lots of memory (3) is raises the latency (response time) of the playback
The correct solution, IMO, is to only add buffers to the queue when the queue is not full.
When the queue is full then the client simply doesn't add buffers.
You could look at how I implemented it in my application (Practice#).
I have a dedicated audio processing thread that keeps producing buffer, and adds them to AdvancedBufferedWaveProvider
only when needed.
Edit: Of course make sure you actually start playing...otherwise indeed the buffer would never get dequeued, with or without queue monitoring logic.