[pulseaudio-discuss] Saving stream volumes per physical output

Lennart Poettering lennart at poettering.net
Tue Jan 5 09:02:24 PST 2010


On Tue, 05.01.10 18:37, Tanu Kaskinen (tanuk at iki.fi) wrote:

> 
> ti, 2010-01-05 kello 14:13 +0100, Lennart Poettering kirjoitti:
> > In m-s-r we store only relative volumes. i.e. attenuation relative to
> > the current sink volume. Since the sink volume is always the max of
> > all streams connected to it this means the attenuation factor we store
> > is never an amplification.
> > 
> > That means that as long as we save/restore the sink volume itself
> > adjustments to what we store about the stream volume should not be
> > necessary.
> 
> Consider this scenario:
> 
> Headphones' port volume is -10 dB. Speakers' port volume is also -10 dB.
> 
> I use headphones, and set the volume to -15 dB, because that is good.
> Then I switch to the speakers. The volume is now a bit too low, so I
> turn it up to -10 dB. Then I switch back to the headphones. m-s-r
> doesn't do anything, because it thinks one stream volume is good for any
> output. But the end result is that now the music is coming 5 dB louder
> to my ears than what I want.
> 
> Maybe you're going to argue that after switching to the speakers I
> should have changed the port volume instead of the stream volume. But if
> I know nothing about the flat volume logic, as would be the case for an
> ordinary user, it's much more likely that I'm just going to tweak the
> music player volume, which modifies the stream volume.

Na. I already agreed that m-d-r needs to be aware of ports and
save/restore volume based on the port that is actually selected
(i.e. remember what I wrote about using $SINKNAME@$PORTNAME). All i
was arguing abvoe was that m-s-r does not to be aware of ports.

m-d-r would then have to listen to port changes of a sink and
save/restore volume then. So the entire changes to m-d-r would be:

1) always save two entries for each sink/source: $SINKNAME and
$SINKNAME@$PORTNAME. Always restore $SINKNAME@$PORTNAME if it is
available, fallback to $SINKNAME.

2) also save/restore data when the port is changed for a sink: save
the settings for the old $SINKNAME@$SINKNAME@$PORTNAME and $SINKNAME,
then load the settins for the new $SINKNAME@$PORTNAME if that exists,
finally save it $SINKNAME again to store the new port.

The changes for that should be fairly easy to implement.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4



More information about the pulseaudio-discuss mailing list