audio: keep volume level internally (not only in AO)
commit7807f46cd1b8f58ee8f2e5f6d7240d7ca7502311
authorUoti Urpala <uau@mplayer2.org>
Mon, 9 Apr 2012 14:39:01 +0000 (9 17:39 +0300)
committerUoti Urpala <uau@mplayer2.org>
Tue, 10 Apr 2012 21:13:11 +0000 (11 00:13 +0300)
tree85233d07756f55a756a2f103773b24013cc57955
parent3a01606dc05b2cedb9792a6f8adefeba6e434ab0
audio: keep volume level internally (not only in AO)

Current volume was always queried from the the audio output driver (or
filter in case of --softvol). The only case where it was stored on
mixer level was that when turning off mute, volume was set to the
value it had before mute was activated. Change the mixer code to
always store the current target volume internally. It still checks for
significant changes from external sources and resets the internal
value in that case.

The main functionality changes are:

Volume will now be kept separately from mute status. Increasing or
decreasing volume will now change it relative to the original value
before mute, even if mute is implemented by setting AO level volume to
0. Volume changes no longer automatically disable mute. The exception
is relative changes up (like the volume increase key in default
keybindings); that's the only case which still disables mute.

Keeping the value internally avoids problems with granularity of
possible volume values supported by AO. Increase/decrease keys could
work unsymmetrically, or when specifying a smaller than default
--volstep, even fail completely. In one case occurring in practice, if
the AO only supports changing volume in steps of about 2 and rounds
down the requested volume, then volume down key would decrease by 4
but volume up would increase by 2 (previous volume plus or minus the
default change of 3, rounded down to a multiple of 2). Now, the
internal value will keep full precision.
command.c
mixer.c
mixer.h
mplayer.c