Alsa initialization change

Jeremy White jwhite at
Wed Jun 15 21:10:04 CDT 2005

> Getting closer, I had to change
> +            /*----------------------------------------------------------------
> +            ** See if it's a valid playback device 
> +            **--------------------------------------------------------------*/
> +            if (ALSA_TestDeviceForWine(card, device, SND_PCM_STREAM_PLAYBACK) == 0)
> to check for < 0 (would return -16 when it failed), and it detected default and worked great!

Well, then you've essentially noop-ed that line.  That
line serves the function of stripping out odd ball
devices (like my Modem), so I am reluctant to lose it.

The rc of -16 is EBUSY.

To be honest, I find it odd that you're getting
a success while the sound card is in use; in
my testing, any attempt to open a pcm that is
in use generates a -16 return code, whether it
be default:0 or plughw:0 or hw:0.  The current
Wine code should fail in that case.

I'm going to send you a quick test program off list,
if you don't mind trying an experiment for me, that
would be great.

> One try it was actually able to open hw:0,0, though the format I was sending through was
> unsupported and ended up failing to play. It would have worked if plug:hw:0,0 was opened instead
> as plug will do format conversion. I would prefer default in that case also however, as wine
> was blocking all my other audio apps from working. Always checking for default, even if hw works,
> might be a good idea.

Well, the rationale now is that we try default:X first, and
then fall back to plughw as the backup.  The direct hw
device is used only when configured (and when we probe
to see if the device is rational).

> Also for
> +        sprintf(ctlname, "hw:%d", fixedctlcard == -1 ? card : fixedctlcard);
> +        rc = snd_ctl_open(&ctl, ctlname, SND_CTL_NONBLOCK);
> the case default was used,  you should open default as well rather then hw:0

Hmm.  You raise a good point.  The plughw device does not function
as a ctl device, so in 'traditional' alsa, you always had to open
hw:X as the ctl device.

Gack.  I want some of the drugs these Alsa developers are using...



More information about the wine-devel mailing list