winealsa.drv patch to enum all software devices from .asoundrc

Chris Robinson chris.kcat at gmail.com
Sat Feb 11 08:24:08 CST 2012


On Saturday, February 11, 2012 2:05:18 PM Нискородов Серёжа wrote:
> > Nope, it won't open in a rate other than 48000hz without plug:. But again,
> > that's fine for mmdevapi as it doesn't support rate conversion by default.
> 
> Hmm... Ok. But how it works in Windows? Does you mean that
> applications take care of sample rate conversion in Windows? Seems
> like it's not.

That's how it works in Windows:
http://msdn.microsoft.com/en-
us/library/windows/desktop/dd370811%28v=vs.85%29.aspx
"An application that uses WASAPI to manage shared-mode streams can rely on the 
audio engine to perform only limited format conversions. The audio engine can 
convert between a standard PCM sample size used by the application and the 
floating-point samples that the engine uses for its internal processing. 
However, the format for an application stream typically must have the same 
number of channels and the same sample rate as the stream format used by the 
device."

I remember seeing this happen with some of my own stuff in Windows, too.

> Here is another trouble with snd_ctl_open. Not all devices in alsa
> configuration files have a predefined ctl. Especially defined by user,
> for example I don't always define a ctls for all my devices in
> .asoundconf

You can use the "hw:" prefix for snd_ctl_open. All you need it for is to get 
the card info and the available device indices, which doesn't rely on a custom 
prefix.

Hmm, actually it seems winealsa already does this enumerating. Except it 
hardcodes the plughw: prefix for the device string, uses the card index 
instead of the name, and doesn't explicitly specify the parameter names (it 
uses "x,y" instead of "CARD=x,DEV=y"). Perhaps I'll see about making some 
patches.

> So what I suggest and what I can do for now:
> 1) To enumerate all devices, that ALSA can enumerate. First in list -
> default device (like it was before), after that - hardware devices
> (like it was before), and below all devices, that returns "aplay -L";
> 2) To disable the testing of device avaliability (by alsa_try_open)
> while enumerating it. Thus, even devices that inaccessible at the time
> of enumeration can be added to the list.
> What you think about?

The problem with also taking everything shown by "aplay -L" is that it has a 
tendency to list the same device multiple times (which themselves are already 
mostly duplicated from the snd_card_next+etc enumeration, just with different 
prefixes). It can greatly increase the number of devices for no reason, IMO. 
You also can't get meaningful names from them (who would know what to make of 
it seeing "HDA NVidia, ALC888 Analog" and "HDA NVidia, ALC888 Digital" next to 
"HDA NVidia - ALC888 Analog" and "HDA NVidia - ALC888 Digital"?).

Registry options to skip device enumeration and to supply a custom list of 
devices will be fine, I think, as well as options to specify custom prefixes.

I'd agree with getting rid of alsa_try_open, unless there's a reason to keep 
it. I don't think there's a good reason to prevent enumerating the extra 
devices that can't be opened here though. It's status as unavailable/in-use 
can be handled later, I think.



More information about the wine-devel mailing list