From 973f396fdc6be24e14956813338fdd0f4532beae Mon Sep 17 00:00:00 2001 From: Al McElrath Date: Wed, 29 Apr 2015 21:08:16 -0700 Subject: set volume via scale, so as to keep balance --- pulse.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pulse.cc b/pulse.cc index abcb668..36f2739 100644 --- a/pulse.cc +++ b/pulse.cc @@ -69,12 +69,11 @@ static void server_info_cb(pa_context* context __attribute__((unused)), } static pa_cvolume* value_to_cvol(long value, pa_cvolume *cvol) { - return pa_cvolume_set(cvol, cvol->channels, - std::max(value * PA_VOLUME_NORM / 100.0, 0.0)); + return pa_cvolume_scale(cvol, std::max(value * PA_VOLUME_NORM / 100.0, 0.0)); } static int volume_as_percent(const pa_cvolume* cvol) { - return round(pa_cvolume_avg(cvol) * 100.0 / PA_VOLUME_NORM); + return round(pa_cvolume_max(cvol) * 100.0 / PA_VOLUME_NORM); } static int xstrtol(const char *str, long *out) { -- cgit v1.2.3