From 14607f27ef01c81e4544d0eaa7ed182001c15305 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 27 Feb 2014 01:07:46 +0100 Subject: command: use the step size for "add volume" commands The step argument for "add volume " was ignored until now. Fix it. There is one problem: by defualt, "add volume" should use the value set with --volstep. This value is 3 by default. Since the default volue for the step argument is always 1 (and we don't really want to make the generic code more complicated by introducing custom step sizes), we simply multiply the step argument with --volstep to keep it compatible. The --volstep option should probably be just removed in the future. --- audio/mixer.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'audio/mixer.c') diff --git a/audio/mixer.c b/audio/mixer.c index 162d9d5a0a..a9759976a2 100644 --- a/audio/mixer.c +++ b/audio/mixer.c @@ -172,21 +172,11 @@ bool mixer_getmute(struct mixer *mixer) return mixer->muted; } -static void addvolume(struct mixer *mixer, float d) +void mixer_addvolume(struct mixer *mixer, float step) { float vol_l, vol_r; mixer_getvolume(mixer, &vol_l, &vol_r); - mixer_setvolume(mixer, vol_l + d, vol_r + d); -} - -void mixer_incvolume(struct mixer *mixer) -{ - addvolume(mixer, mixer->opts->volstep); -} - -void mixer_decvolume(struct mixer *mixer) -{ - addvolume(mixer, -mixer->opts->volstep); + mixer_setvolume(mixer, vol_l + step, vol_r + step); } void mixer_getbalance(struct mixer *mixer, float *val) -- cgit v1.2.3