diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2021-03-14 12:48:56 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-04-07 14:38:54 -0400 |
commit | 213d372c929668417e7c89468a0adf284377b161 (patch) | |
tree | 4f4b9760fac4851dcdb9ae8bf738b1c7beee44e6 | |
parent | c5cf15ed02aefe4f2654ae6a0b7794733125b8d2 (diff) | |
download | rockbox-213d372c929668417e7c89468a0adf284377b161.tar.gz rockbox-213d372c929668417e7c89468a0adf284377b161.zip |
FS#13272: Fix up volume_limit to respect decimilaztion.
Change-Id: Ib0e5ddcd660115f156ddb545e45bbe7da42f9709
-rw-r--r-- | apps/menus/sound_menu.c | 13 | ||||
-rw-r--r-- | firmware/sound.c | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c index b88fc2a043..00fe006399 100644 --- a/apps/menus/sound_menu.c +++ b/apps/menus/sound_menu.c | |||
@@ -38,6 +38,14 @@ | |||
38 | #include "option_select.h" | 38 | #include "option_select.h" |
39 | #include "misc.h" | 39 | #include "misc.h" |
40 | 40 | ||
41 | static const char* vol_limit_format(char* buffer, size_t buffer_size, int value, | ||
42 | const char* unit) | ||
43 | { | ||
44 | (void)unit; | ||
45 | format_sound_value(buffer, buffer_size, SOUND_VOLUME, value); | ||
46 | return buffer; | ||
47 | } | ||
48 | |||
41 | static int volume_limit_callback(int action, | 49 | static int volume_limit_callback(int action, |
42 | const struct menu_item_ex *this_item, | 50 | const struct menu_item_ex *this_item, |
43 | struct gui_synclist *this_list) | 51 | struct gui_synclist *this_list) |
@@ -51,13 +59,13 @@ static int volume_limit_callback(int action, | |||
51 | volume_limit_int_setting.min = sound_min(SOUND_VOLUME); | 59 | volume_limit_int_setting.min = sound_min(SOUND_VOLUME); |
52 | volume_limit_int_setting.max = sound_max(SOUND_VOLUME); | 60 | volume_limit_int_setting.max = sound_max(SOUND_VOLUME); |
53 | volume_limit_int_setting.step = sound_steps(SOUND_VOLUME); | 61 | volume_limit_int_setting.step = sound_steps(SOUND_VOLUME); |
54 | volume_limit_int_setting.formatter = NULL; | 62 | volume_limit_int_setting.formatter = vol_limit_format; |
55 | volume_limit_int_setting.get_talk_id = NULL; | 63 | volume_limit_int_setting.get_talk_id = NULL; |
56 | 64 | ||
57 | struct settings_list setting; | 65 | struct settings_list setting; |
58 | setting.flags = F_BANFROMQS|F_INT_SETTING|F_T_INT|F_NO_WRAP; | 66 | setting.flags = F_BANFROMQS|F_INT_SETTING|F_T_INT|F_NO_WRAP; |
59 | setting.lang_id = LANG_VOLUME_LIMIT; | 67 | setting.lang_id = LANG_VOLUME_LIMIT; |
60 | setting.default_val.int_ = sound_max(SOUND_VOLUME); | 68 | setting.default_val.int_ = volume_limit_int_setting.max; |
61 | setting.int_setting = &volume_limit_int_setting; | 69 | setting.int_setting = &volume_limit_int_setting; |
62 | 70 | ||
63 | switch (action) | 71 | switch (action) |
@@ -253,4 +261,3 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio, | |||
253 | ,&speaker_mode | 261 | ,&speaker_mode |
254 | #endif | 262 | #endif |
255 | ); | 263 | ); |
256 | |||
diff --git a/firmware/sound.c b/firmware/sound.c index 6fe6115406..2a423177a7 100644 --- a/firmware/sound.c +++ b/firmware/sound.c | |||
@@ -54,7 +54,7 @@ static const struct sound_setting_entry * get_setting_entry(int setting) | |||
54 | { "", 0, 0, 0, 0, 0 }; | 54 | { "", 0, 0, 0, 0, 0 }; |
55 | 55 | ||
56 | static const struct sound_setting_entry default_entry = | 56 | static const struct sound_setting_entry default_entry = |
57 | { &default_info, NULL }; | 57 | { &default_info, NULL }; |
58 | 58 | ||
59 | if ((unsigned)setting >= ARRAYLEN(sound_setting_entries)) | 59 | if ((unsigned)setting >= ARRAYLEN(sound_setting_entries)) |
60 | return &default_entry; | 60 | return &default_entry; |
@@ -120,7 +120,7 @@ int sound_current(int setting) | |||
120 | { | 120 | { |
121 | switch(setting) | 121 | switch(setting) |
122 | { | 122 | { |
123 | #ifndef BOOTLOADER | 123 | #ifndef BOOTLOADER |
124 | #ifndef PLATFORM_HAS_VOLUME_CHANGE | 124 | #ifndef PLATFORM_HAS_VOLUME_CHANGE |
125 | SOUND_CUR_SET(VOLUME, global_settings.volume) | 125 | SOUND_CUR_SET(VOLUME, global_settings.volume) |
126 | #endif | 126 | #endif |