forked from pool/alsa-utils
Takashi Iwai
24132c8d0f
OBS-URL: https://build.opensuse.org/request/show/55434 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=29
41 lines
1.6 KiB
Diff
41 lines
1.6 KiB
Diff
From 70a01748d594ef57a1962e4cb012927faf6d852f Mon Sep 17 00:00:00 2001
|
|
From: Clemens Ladisch <clemens@ladisch.de>
|
|
Date: Mon, 6 Dec 2010 14:05:10 +0100
|
|
Subject: [PATCH 42/43] alsamixer: increase step size for big control value ranges
|
|
|
|
For controls with a big range, stepping through all values can become
|
|
tedious and make it impossible to adjust the volume easily. Therefore,
|
|
ensure that all steps are big enough so that the full range has at most
|
|
one hundred steps.
|
|
|
|
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
|
|
---
|
|
alsamixer/mixer_widget.c | 4 +++-
|
|
1 files changed, 3 insertions(+), 1 deletions(-)
|
|
|
|
diff --git a/alsamixer/mixer_widget.c b/alsamixer/mixer_widget.c
|
|
index c8ca156..adb4568 100644
|
|
--- a/alsamixer/mixer_widget.c
|
|
+++ b/alsamixer/mixer_widget.c
|
|
@@ -318,7 +318,7 @@ static void change_volume_to_percent(struct control *control, int value, unsigne
|
|
set_func(control->elem, control->volume_channels[1], min + (max - min) * value / 100);
|
|
}
|
|
|
|
-static void change_volume_relative(struct control *control, int delta, unsigned int channels)
|
|
+static void change_volume_relative(struct control *control, long delta, unsigned int channels)
|
|
{
|
|
int (*get_range_func)(snd_mixer_elem_t *, long *, long *);
|
|
int (*get_func)(snd_mixer_elem_t *, snd_mixer_selem_channel_id_t, long *);
|
|
@@ -352,6 +352,8 @@ static void change_volume_relative(struct control *control, int delta, unsigned
|
|
if (err < 0)
|
|
return;
|
|
}
|
|
+ if (max - min > 100)
|
|
+ delta = (delta * (max - min) + (delta > 0 ? 99 : -99)) / 100;
|
|
if (channels & LEFT) {
|
|
value = left + delta;
|
|
if (value < min)
|
|
--
|
|
1.7.3.1
|
|
|