projects
/
profile
/
ivi
/
pulseaudio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
96f01b8
)
volume: round properly when showing human readable volume percentages
author
Lennart Poettering
<lennart@poettering.net>
Tue, 18 Aug 2009 22:58:20 +0000
(
00:58
+0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 18 Aug 2009 22:58:20 +0000
(
00:58
+0200)
src/pulse/volume.c
patch
|
blob
|
history
diff --git
a/src/pulse/volume.c
b/src/pulse/volume.c
index
0d40237
..
ee86938
100644
(file)
--- a/
src/pulse/volume.c
+++ b/
src/pulse/volume.c
@@
-292,7
+292,7
@@
char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c) {
l -= pa_snprintf(e, l, "%s%u: %3u%%",
first ? "" : " ",
channel,
- (c->values[channel]*100)/PA_VOLUME_NORM);
+ (c->values[channel]*100
+PA_VOLUME_NORM/2
)/PA_VOLUME_NORM);
e = strchr(e, 0);
first = FALSE;
@@
-312,7
+312,7
@@
char *pa_volume_snprint(char *s, size_t l, pa_volume_t v) {
return s;
}
- pa_snprintf(s, l, "%3u%%", (v*100)/PA_VOLUME_NORM);
+ pa_snprintf(s, l, "%3u%%", (v*100
+PA_VOLUME_NORM/2
)/PA_VOLUME_NORM);
return s;
}