The application will generally set the format of the primary buffer to match the secondaries to ensure maximum performance. Unfortunately, since 2k and xp lie to the application and accept anything requested without regard to performance (actual hardware capabilities), some applications may not (or even be able to) do the optimal thing. This also lets manufacturers produce cheap dumb hardware and lets the software fix it up. We have win modems and win printers and now we are getting win sound cards.
The OSS driver already tries all formats and returns it in the capabilities. In the case of alsa OSS emulation, what it reports and what it will actually mmap could be different. This is either a bug or design feature of alsa. You could try to mmap every format to see if it really supports that format but that's working around the driver. Direct sound shouldn't have to second guess what the driver is telling it. What alsa needs (and may already have) is a way to determine what is supported in hardware and what will be emulated and let the application figure out what is best but alsa wants to hide the implementation details. This is also the purpose of direct sound so they are both trying to do the same thing. The commercial OSS implementation also will do a software emulation of whatever you ask for but they also provide a way of disabling it if needed.
Roderick Colenbrander wrote:
Ok, will default to 8bit mono then. Shouldn't we add some options then to let the user select stereo and other things? Else dsound will about allways use this mode.
My other patch fixed the problem with sample rate conversion (for alsa). If a wrong format was detected the winealsa driver would tell dsound to use a different format. Atleast this worked before Mike's patch.
For the alsa oss emulation problem I have a workaround which I will port over and clean up. Basicly it opens the device for about all formats and if opening fails it means that a mode isn't supported.
Roderick
On Saturday 27 March 2004 20:36, Robert Reif wrote:
I'm not sure deviating from the Microsoft behavior is correct. The default is 22khz 8 bit mono unless the hardware doesn't support it. Transgaming is correct.
Another problem is that drivers support different formats in different modes. Because of software emulation in alsa, a driver may appear to support any format but then fail when you try to mmap it because then software conversions can't come into play. This is also a problem with OSS emulation in alsa on this type
of hardware.
Roderick Colenbrander wrote:
Hi,
This is the first of two patches that will fix some problems on soundcards using the i810 audio codec. The main probem with this soundcard is that it only supports a frequency of 48kHz in 16bit stereo mode.
This first patch to dsound queries if the card supports 16bit and if so it uses it, else it uses 8bit. Further it also detects if the card supports stereo or not. The patch was inspired by one from transgaming to rewind but that patch did a bit the opposite (defaulting to 8bit ..).
Roderick Colenbrander
Name: dsound dsound Type: text/x-diff Encoding: 7bit