From: Josef Gajdusek <atx@atx.name>
To: patch@alsa-project.org
Cc: alsa-devel@alsa-project.org
Subject: [PATCH] amixer: Fix convert_prange1 not rounding correctly
Date: Sun, 6 Jul 2014 20:25:10 +0200 [thread overview]
Message-ID: <20140706182510.GA6314@dashie> (raw)
The convert_prange1 macro was not the exact inverse of convert_prange.
This was causing the volume percentage set by 'amixer set' to differ from the
one displayed by 'amixer get'.
Signed-off-by: Josef Gajdusek <atx@atx.name>
---
amixer/amixer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/amixer/amixer.c b/amixer/amixer.c
index cf82892..577a2ca 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -201,7 +201,7 @@ static int convert_prange(long val, long min, long max)
/* Function to convert from percentage to volume. val = percentage */
#define convert_prange1(val, min, max) \
- ceil((val) * ((max) - (min)) * 0.01 + (min))
+ rint((val) * ((max) - (min)) * 0.01 + (min))
struct volume_ops {
int (*get_range)(snd_mixer_elem_t *elem, long *min, long *max);
--
1.8.5.5
reply other threads:[~2014-07-06 18:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140706182510.GA6314@dashie \
--to=atx@atx.name \
--cc=alsa-devel@alsa-project.org \
--cc=patch@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox