Re: uaudio device re-attach and persisting dev.pcm.$pcm.bitperfect sysctl

From: Christos Margiolis <christos_at_freebsd.org>
Date: Thu, 03 Oct 2024 14:30:57 UTC
Hello Tomasz,

Tomoaki AOKI wrote:
> Maybe what newbies want would be:
>   *Currently active audio device is always seen as exactly the same,
>    without device number or something.

What do you mean exactly?

>   *Basically newly attached "physical" device is always preferred.
>    For example:
>     If a USB audio is plugged and powered on, it is preferred.
>     After that, if a headphone is plugged into the connector,
>     the headphone is automagically selected and other outputs
>     are automatically muted.
>     After that, if optical SPDIF is connected, mute headphone and
>     route output to SPDIF.
>     When the SPDIF plug is disconnected, automatically fall back to
>     headphone.
>     If the headphone is plugged out before SPDIF, fall back to USB,
>     and more, if USB is not available ATM, fall back to PC speaker.
> 
> Cannot point into specific posts, but I see screams like "Hey, I
> cannot hear audio output from headphone. How can I do it?!" in Forums.
> And currently the answers should be quite specific with the
> questioner's environment (including hardware quirks) and hard to
> answer.

The headphone issue is present only in snd_hda(4), and it's because many
HDA manufacturers assign non-standard mappings to the headphone and jack
pins, so the driver needs to be manually patched in order to support
them. That being said, I am planning to attempt to automate the method
with which we tell what the correct mappings should be. If this attempt
works, it will most likely still not solve all cases, but might simplify
things a bit.

> Would be complexed to implement (automate). But parts of those is
> possible by virtual_oss, by letting it create /dev/dsp, without number.
> And ports supporting base OSS to default to unnumbered device.
>
> My basic assumption is that virtual_oss would be worth incorporated
> in base at some time in the future.

That's in the plans already. The only obstacle at the moment is that
virutal_oss uses third party libraries.

Christos