http://bugs.winehq.org/show_bug.cgi?id=29585
--- Comment #15 from Andrew Eikum aeikum@codeweavers.com 2012-02-01 14:30:01 CST --- Created attachment 38649 --> http://bugs.winehq.org/attachment.cgi?id=38649 wineoss.drv: Don't call GETOSPACE immediately after device initialization
Hmm, removing the GETOSPACE call in IAudioClient::Initialize and hard-coding the same result makes it work. I tried writing some silence before that call, but that didn't work.
The GETOSPACE docs say, "This ioctl must in no case be called before the device setup is finished." But we set channels, rate, and format before making the GETOSPACE call, so it seems like this is a valid call (see http://manuals.opensound.com/developer/callorder.html). Even more annoyingly, the call works fine in some games, but not in other games.
I think we can get away with initializing the oss_buffersize_bytes variable to 0, since we detect new maximums anyway before actually using it. See attached patch.
Why does GETOSPACE break the device in this strange way? Maybe the device needs a few milliseconds to settle, and calling GETOSPACE before that breaks the device? This seems plausible. I think we make the exact same order of calls with and without this patch (SETFMT, CHANNELS, SPEED, GETOSPACE), but with this patch, we only make the GETOSPACE call during the first write() callback after IAC::Start(), not immediately after initialization.