From 5eff48dddb547a4c7f9914b5430b28fe31c3d144 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 15 Jul 2010 11:15:22 +0200 Subject: use pa_cvolume_set instead of iterating manually --- src/interface.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/interface.c b/src/interface.c index 771127b..76fb29e 100644 --- a/src/interface.c +++ b/src/interface.c @@ -187,10 +187,11 @@ void get_input(void) }; } else break; - int input_vol = tmp.tmp_vol + 2 * volume_mult * (VOLUME_MAX / 100); - tmp.tmp_vol = CLAMP(input_vol, VOLUME_MIN, VOLUME_MAX); /* force input_vol in [0, VOL_NORM] */ - for (int i = 0; i < tmp.volume.channels; ++i) - tmp.volume.values[i] = tmp.tmp_vol; + + pa_cvolume_set(&tmp.volume, tmp.volume.channels, + CLAMP(tmp.tmp_vol + 2 * volume_mult * (VOLUME_MAX / 100), + VOLUME_MIN, VOLUME_MAX) /* force vol in [0, VOL_MAX] */ + ); pa_operation_unref(tmp.volume_set(context, tmp.index, &tmp.volume, change_callback, NULL)); return; -- cgit