[pulseaudio-discuss] Flat volumes and restoring the app volume
tanuk at iki.fi
Mon Jan 31 12:11:11 PST 2011
On Mon, 2011-01-31 at 10:45 +0000, Colin Guthrie wrote:
> > Also, what does m-s-r actually save? Is it "volume the app will have
> > if the system volume will be 100%" in case of flat volumes?
> IIRC it contains the relative offset from System volume as a factor -
> e.g. if System volume increases, so does application. This can be seen
> quite easily by simply setting System volume to 75%, and a Stream volume
> to 50% (factor of two thirds). Then increase the System volume to 100%
> and see how the Stream volume moves to 67%. I think it is this factor
> that is actually stored (but I could be wrong).
> Looking briefly at the code, it stores a standard pa_cvolume structure
> (volume for each channel), but when m-s-r, saves and subsequently
> applies the volumes, it does so in non-absolute mode, which means that
> it saves the relative ratio and when it's restored, it's multiplied by
> the sink's reference volume.
> So in the case of the example above, it would be stored is always two
> thirds regardless of whether the sink volume itself was changed.
That description is generally right, but slightly inaccurate: m-s-r
doesn't save percentage ratios but decibel differences. So if a stream
has volume that is -10 dB relative to the sink volume - sorry, I mean
the "system volume" - it will be restored to -10 dB relative to whatever
the system volume is at the time of restoring.
> I'd have to look further at how the reference_ratio and the reference
> volumes themselves work in non-FV mode to give anymore insights but
> others may be more familiar with that already without having to poke
> around as much as me.
In the non-flat-volume mode stream-restore works exactly the same way as
in the flat-volume mode, that is, it saves and restores the decibel
difference between the sink and the stream volume. In case of the
non-flat-volume mode, the difference happens to be always the same as
the externally visible stream volume, while in the flat-volume mode
that's not the case.
This actually would have been a good addition to Colin's description of
the flat-volume mode, but unfortunately I already deleted that part of
the quoted message... The flat-volume mode, as currently implemented,
actually does two orthogonal things. I'll call the other the
"actual-flat-volume" feature and the other the "aggressive-hw-volume"
feature. Colin explained the latter. The "actual-flat-volume" feature
means that stream volume ranges cover the whole sink volume range, so
they are "absolute" volumes, as opposed to being relative to the current
In the old days, 100% in the stream volume range meant that the stream
would be played at whatever volume the sink happens to currently have.
Now, with the "actual-flat-volume" feature, 100% in the stream volume
range means that the stream is being played at the maximum volume of
what the sink is capable of providing. It's called "flat" volume,
because now when you notice that your music player is too quiet, you can
increase its volume by using only the stream volume slider, without
caring about the current sink volume at all. Only one level of volume
controls, yay! Earlier, it was possible that the music player volume was
already at 100% but it was still too quiet, because the sink volume was
set too low.
More information about the pulseaudio-discuss