amixer: fix rounding of relative changes

When doing control changes by a relative amount, amixer used the wrong
rounding direction, which would make it possible to stay at the same raw
value if the step was not big enough to reach the next value.

Reported-by: Honza Javorek <jan.javorek@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
This commit is contained in:
Clemens Ladisch 2012-11-13 21:54:20 +01:00
parent c6614dbdab
commit da1c24a24c

View file

@ -425,10 +425,10 @@ static int set_volume_simple(snd_mixer_elem_t *elem,
invalid = 1;
if (*p == '+') {
val = orig + val;
correct = -1;
correct = 1;
} else {
val = orig - val;
correct = 1;
correct = -1;
}
}
p++;