Le 01/05/2020 à 15:01, Mark Kettenis a écrit :
Date: Fri, 1 May 2020 14:17:56 +0200
From: Alexandre Ratchov <a...@caoua.org>
On Fri, May 01, 2020 at 01:11:16PM +0200, Damien Couderc wrote:
Speaking of the hdmi-only devices that were disabled in 2009: does the
project still stand on this position in 2020? I made a quick search and it
seems that more than half of the screens are audio capable now. I understand
the defaults back in 2009, but now is it still true?
There's nothing wrong with hdmi-only devices. As long as audio works
by default with no tweaks, nobody will object to re-enabling
them. AFAIK, this was the only reason to disable them.
Right. The main issue was that by default we only send output to
audio0. On many machines the audio device associated with the HDMI
port appears before the audio device that is associated with the
speakers and/or headphone jack on our laptops. Therefore by default
audio would go to an unconnected HDMI. Just enabling digital-only
devices would not work.
There are a couple things we could do here.
1. Make sndiod(8) responsible for picking a default output device.
I thought it was the case with the -f and -F options:
-F device
Specify an alternate device to use. If it doesn't work,
the one
given with the last -f or -F options will be used. For
instance,
specifying a USB device following a PCI device allows
sndiod to
use the USB one preferably when it's connected and to fall
back
to the PCI one when it's disconnected.
-f device
Add this sndio(7) audio device to devices used for playing
and/or
recording. Preceding per-device options (-aberwz) apply
to this
device. Sub-devices (-s) that are applied after will be
attached
to this device. Device mode and parameters are determined
from
sub-devices attached to it.
So if I'm not wrong it could be possible to set the -f option with the
analog device and the -F option with the digital-only one.
That said, it would work only if you have two audio device (e.g. HDMI
from video card as audio0 and analog from soundcard as audio1).
This is not true on Thinkpad laptops for example because they have two
output codecs on the same device for both analog and digital (and only
one is kept actually).
Maybe we could make first analog and first digital codec available on
each audio device. Then sndiod would take the first analog and the first
digital from the devices in the given order. Does it sound sane?
2. Use locators (like I did for drm(4) and wsdisplay(4)) such that
audio0 is always the non-HDMI audio device.
Option #2 has the downside that if your HDMI audio device is the only
supported audio device in the system, it will still be audio1 and
therefore not the default device. On the other hand that has the
benefit that if you later plug something like uaudio(4) into your
system it will become the default device.
Option #1 would give us more flexibility, but I'm not sure if the
current audio(4) ioctls allow us to implement the proper heuristics.
About the multi-codec devices, how do you see it ? Keeping all the codecs
and adding a knob to switch between analog and digital to select the codec >
This seems to make sense.
It's never entirely clear to me what exactly a "codec" is. But if it
is possible to use both codecs simultaniously and indipendently, it
would make sense to provide audio(4) devices for both.