FS#13272: Fix up volume_limit to respect decimilaztion.

Change-Id: Ib0e5ddcd660115f156ddb545e45bbe7da42f9709
This commit is contained in:
Solomon Peachy 2021-03-14 12:48:56 -04:00
parent c5cf15ed02
commit 213d372c92
2 changed files with 12 additions and 5 deletions

View file

@ -38,6 +38,14 @@
#include "option_select.h"
#include "misc.h"
static const char* vol_limit_format(char* buffer, size_t buffer_size, int value,
const char* unit)
{
(void)unit;
format_sound_value(buffer, buffer_size, SOUND_VOLUME, value);
return buffer;
}
static int volume_limit_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
@ -51,13 +59,13 @@ static int volume_limit_callback(int action,
volume_limit_int_setting.min = sound_min(SOUND_VOLUME);
volume_limit_int_setting.max = sound_max(SOUND_VOLUME);
volume_limit_int_setting.step = sound_steps(SOUND_VOLUME);
volume_limit_int_setting.formatter = NULL;
volume_limit_int_setting.formatter = vol_limit_format;
volume_limit_int_setting.get_talk_id = NULL;
struct settings_list setting;
setting.flags = F_BANFROMQS|F_INT_SETTING|F_T_INT|F_NO_WRAP;
setting.lang_id = LANG_VOLUME_LIMIT;
setting.default_val.int_ = sound_max(SOUND_VOLUME);
setting.default_val.int_ = volume_limit_int_setting.max;
setting.int_setting = &volume_limit_int_setting;
switch (action)
@ -253,4 +261,3 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
,&speaker_mode
#endif
);

View file

@ -54,7 +54,7 @@ static const struct sound_setting_entry * get_setting_entry(int setting)
{ "", 0, 0, 0, 0, 0 };
static const struct sound_setting_entry default_entry =
{ &default_info, NULL };
{ &default_info, NULL };
if ((unsigned)setting >= ARRAYLEN(sound_setting_entries))
return &default_entry;
@ -120,7 +120,7 @@ int sound_current(int setting)
{
switch(setting)
{
#ifndef BOOTLOADER
#ifndef BOOTLOADER
#ifndef PLATFORM_HAS_VOLUME_CHANGE
SOUND_CUR_SET(VOLUME, global_settings.volume)
#endif