[pulseaudio-discuss] Saving stream volumes per physical output

Tanu Kaskinen tanuk at iki.fi
Tue Jan 5 19:18:40 PST 2010


ke, 2010-01-06 kello 00:16 +0100, Lennart Poettering kirjoitti:
> On Tue, 05.01.10 19:37, Tanu Kaskinen (tanuk at iki.fi) wrote:
> 
> > 
> > ti, 2010-01-05 kello 18:02 +0100, Lennart Poettering kirjoitti:
> > > On Tue, 05.01.10 18:37, Tanu Kaskinen (tanuk at iki.fi) wrote:
> > > > 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.
> > 
> > I fail to see how port volumes in m-d-r help in any way in my scenario.
> > The sink/port reference volumes stay at -10 dB all the time so whatever
> > m-d-r does, it isn't visible to the outside world. When switching back
> > to the headphones, it's the job of m-s-r to restore the stream volume
> > back to the -5 dB relative volume (actually I think that m-s-r should
> > restore the absolute volume, but let's not go there yet).
> 
> I am not sure I follow. When you speak about "switching" to
> headphones/speakers you do mean that you change the port of the sink,
> right?

Yes.

> So you have one music stream playing at -10dB absolute on the
> headphones. The ref volume on the sink is 0dB absolute. Now you switch
> the port to the speakers. m-d-r should become active and set the new
> ref volume for the sink to let's say -5 dB absolute. Since the stream
> volume is stored relatively internally the resulting absolute stream
> volume for your stream would be -15dB. Which is what is intended I
> would say.

That describes just one port switch, right? To continue from where you
left off, what if I, for whatever reason, am not happy with the chosen
speaker volume and change the music stream volume to -5 dB absolute (= 0
dB relative)? Then at some point I switch back to the headphones. m-d-r
restores the sink reference volume to 0 dB and m-s-r doesn't do
anything. Now the music stream has also absolute volume 0 dB, which is
10 dB more than what I want the headphones to have. When I changed the
volume while using the speakers, it shouldn't have affected the volume
that I get when using the headphones.

-- 
Tanu Kaskinen




More information about the pulseaudio-discuss mailing list