http://bugs.winehq.org/show_bug.cgi?id=29585
--- Comment #6 from Andrew Eikum aeikum@codeweavers.com 2012-01-23 12:46:06 CST --- (In reply to comment #5)
Looks like what we know from ALSA/dmix. Let's suppose OSS remixes to 48000. A 1024 fragments buffer at 48000 lasts 21.333ms, a period we now know well from HDA. What's the fragment size for something at 7092 samples per second? 7092 * 21.333ms -> 151.3
Nice!
So the trouble remains, how can we limit the data we write to OSS?
Surprising answer? We won't! Write as much as possible in non-blocking mode.
How do we implement Stop() then?
Here's a complicated plan. Maintain a read pointer in the MMDevAPI buffer, which we advance when writing _only_after_ the first write. During Stop(), we use DSP_HALT to empty the OSS buffer, and then in Start() fill the OSS buffer from that read pointer. So, we have three pointers into the MMDevAPI buffer: one which emulates the OSS device position within the buffer, one which points to valid data not yet written to OSS, and one where the client application writes to.
Sound sane?