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

Chris Robinson chris.kcat at gmail.com
Fri Feb 10 22:47:20 CST 2012


On Friday, February 10, 2012 10:50:33 PM Нискородов Серёжа wrote:
> Not only sample type, but sample rate to. For example, dmix plugin
> have predefined samplerate for mixing, so if WINE send other
> samplerate to it without "plug:" wrapper, in best case you will get
> error message and no sound.

As I mentioned, native mmdevapi doesn't do samplerate conversion or channel 
remixing. For shared mode, the device only opens with a pre-defined, user-
selected rate and channel config. The only thing the default native mmdevapi 
will do is accept different sample depths/type (prefering float32). It's up to 
the app or whatever component is using mmdevapi to convert to the 
rate/channels given by GetMixFormat.

Any other conversion besides sample type is reliant on the user having 
installed plugins that'll do the wanted conversion. If it really becomes an 
issue (which it shouldn't), Wine could support these and have some by default.

> > FWIW, my custom dmix device for 5.1 Surround output shows up in aplay -L
> > with a colon, as it's defined to accept arguments for the output device
> > instead of hardcoding one, and neither plain 'dmix' or 'default' get
> > listed. The only name without a colon is 'null'.
> 
> Seems like devices without a colon in names is only devices defined in
> /etc/asound.conf or in ~/.asoundrc

My dmix51 device is defined in /etc/asound.conf. The difference is, it's 
defined to accept CARD, DEV, and SUBDEV parameters similar to regular dmix, so 
ALSA will enumerate it for each CARD and DEV that can support its output 
parameters.

> > dmix51:CARD=NVidia,DEV=1
> >    HDA NVidia, ALC888 Digital
> >    Direct sample mixing device (5.1 Surround)
> > 
> > All but "dmix51:CARD=NVidia,DEV=0" is completely useless
> 
> Do you can play wav mono 11025Hz directly to your dmix51 device?
> Without "plug:" wrapper?
> With my soundcard I can't.

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.

> So I can enumerate dmix*: devices to, I even can enumerate all
> devices, but I see almost no sence in this.

What I'd suggest is using snd_card_next, snd_ctl_open (which won't lock the 
device like snd_pcm_open), snd_ctl_pcm_next_device, and related, to enumerate 
available card names and device indices, and have a configuration option in 
winecfg or somewhere to specify the prefix used ("dmix:", "plughw:", something 
custom, etc). Maybe another option to specify an additional list of custom 
devices that can't be detected this way, though most users shouldn't need that 
with the appropriate device prefix selected.

Just make sure to use the card name given by snd_ctl_card_info_get_id, so that 
the CARD parameter remains constant even if the card index changes.



More information about the wine-devel mailing list