diff options
| author | PurlingNayuki <cyq.yzfl@gmail.com> | 2013-12-21 21:33:54 +0800 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2014-01-13 11:32:03 +0100 |
| commit | f0bec023d9ff45cede09274dff12f015f0830a38 (patch) | |
| tree | 88af20d2941735f441491762daa4139d1bbbbed0 /apps/gui/option_select.c | |
| parent | 31dfabfa254235516dde148f16fa2ac4d522944d (diff) | |
| download | rockbox-f0bec023d9ff45cede09274dff12f015f0830a38.zip rockbox-f0bec023d9ff45cede09274dff12f015f0830a38.tar.gz rockbox-f0bec023d9ff45cede09274dff12f015f0830a38.tar.bz2 rockbox-f0bec023d9ff45cede09274dff12f015f0830a38.tar.xz | |
Implement volume limiter feature
Add a "volume limit" parameter to the configuration file. The maximum
value of volume setting in sound menu will be limited to the same as
volume limit. Also each time when setvol() is excuted, Rockbox will
check if the global_settings.volume value larger than
global_settings.volume_limit. If larger, take the value of volume_limit
instead. The volume_limit argument shares the same maximum and minimum values
with volume argument, while taking the maximum volume as its default value.
Change-Id: I8ca9bc6ea6e617b48fc346aae5f2a0a1d259ae36
Reviewed-on: http://gerrit.rockbox.org/697
Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
Diffstat (limited to 'apps/gui/option_select.c')
| -rw-r--r-- | apps/gui/option_select.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index d42d081..0452467 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -345,7 +345,8 @@ static int selection_to_val(const struct settings_list *setting, int selection) int setting_id = setting->sound_setting->setting; #ifndef ASCENDING_INT_SETTINGS step = sound_steps(setting_id); - max = sound_max(setting_id); + max = (setting_id == SOUND_VOLUME) ? + global_settings.volume_limit : sound_max(setting_id); /* min = sound_min(setting_id); */ #else step = -sound_steps(setting_id); @@ -429,7 +430,8 @@ static void val_to_selection(const struct settings_list *setting, int oldvalue, int setting_id = setting->sound_setting->setting; int steps = sound_steps(setting_id); int min = sound_min(setting_id); - int max = sound_max(setting_id); + int max = (setting_id == SOUND_VOLUME) ? + global_settings.volume_limit : sound_max(setting_id); *nb_items = (max-min)/steps + 1; #ifndef ASCENDING_INT_SETTINGS *selected = (max - oldvalue) / steps; |