]> git.alsa-project.org Git - alsa-utils.git/commitdiff
amixer: fix rounding of relative changes
authorClemens Ladisch <clemens@ladisch.de>
Tue, 13 Nov 2012 20:54:20 +0000 (21:54 +0100)
committerClemens Ladisch <clemens@ladisch.de>
Tue, 13 Nov 2012 20:54:20 +0000 (21:54 +0100)
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>
amixer/amixer.c

index a0a738750e59f86403d017c179908de4e2b2023b..48ed1b2ffe337794cbb9b9a17be806302b1899e9 100644 (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++;