One sink per port - why?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2017-01-04 at 16:19 +0000, Marc Warne wrote:
> Hi,
> 
> I have a PC that just has its own internal sound card, nothing special. 
> However, this card (HDA Intel) has three output ports: analogue, HDMI 
> and optical.
> 
> I have been trying to find a way to get output on both the analogue and 
> HDMI ports at the same time. I have succeeded, but had to use command 
> line/default.pa to do this because of how sinks appear to be configured.
> 
> My understanding is as follows:
> 
>    1. When using pavucontrol or the Ubuntu sound settings, you can see 
> the card under Output Devices.

I'm not familiar with Ubuntu sound settings, but in pavucontrol Output
Devices shows the sinks. A sound card can have multiple sinks.

>    2. The drop down list is a set of ports for this sound card.

In pavucontrol it's the list of ports that the sink has. Only one port
can be active on a sink at a time, that's a hardware limitation. You're
interested in having analog, HDMI and optical outputs active at the
same time, and these are not ports on a sink, they are separate sinks.

>    3. Only one port can be set at a time.

Yes, one port per sink, but you can have multiple sinks.

> I've also noticed that "pavcmd list-sinks" only ever lists one sink. 
> When a port is changed using pavucontrol, there is still just one sink 
> available, but it's a different port and different index.

I suspect that you actually mean switching a card profile in
pavucontrol's "Configuration" tab. That's how you switch between the
different sinks. When a profile is changed, the sinks of the old
profile are removed and the sinks of the new profile are created. This
makes the sink indexes change. Switching ports on a sink doesn't
involve any index changes.

> So if only one sink is ever available, I cannot create a new combine 
> sink, whether using the command line or paprefs, as it will just create 
> a combine sink on the one sink, which is pointless.
> 
> My questions are:
> 
>    1. When setting a new port using the GUI, is the old sink module 
> unloaded, and the new one for the new port loaded?

To be exact, no modules are unloaded or loaded (there's no 1:1 mapping
between sinks and modules). Switching a port doesn't cause other
changes than changing the active port of a sink, and switching a card
profile causes sinks to be removed and created.

>    2. Why? I would have expected there to be a sink for each port, and 
> just the default configured via the GUI, but this doesn't appear to be 
> the case.

It is possible to have a card profile that has sinks for analog, HDMI
and optical at the same time. There's an example at the end of
/usr/share/pulseaudio/alsa-mixer/profiles/default.conf that creates a
profile with analog and optical outputs.

The reason why we don't create any profiles with multiple sinks by
default is that, well, nobody has written the code for that. Long time
ago it wasn't possible to switch between analog, HDMI and optical at
all, except by manually loading sinks for them. Then "card profiles"
were introduced, which allowed to change the card profile with a GUI.
That was an improvement. More improvements could be done.

Note that not all combinations of sinks and sources are possible. When
pulseaudio starts, it tries all sink+source combinations, and those
that work are added to the profiles list. If we were to extend the list
with all possible combinations of multiple sinks and sources, the list
would grow very rapidly. I think it would probably be possible to come
up with some scheme that would create multi-sink profiles by default,
but not explode the profile list, but I don't know how exactly that
would work.

-- 
Tanu

https://www.patreon.com/tanuk


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux