From dd2a0aeab03aa3f014411ef63d08d295a45cc3de Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Tue, 22 Nov 2022 23:21:48 +0000 Subject: Use perceptual volume scale for volume bars Display volume bars using a perceptual scale instead of the linear dB scale. This makes adjusting volume with the bar a lot more usable on touchscreen targets. Change-Id: I2db010486e6ba17f9d08202ee74a0b509f2cb434 --- apps/gui/skin_engine/skin_display.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'apps/gui/skin_engine') diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 9cc9e8c74d..913bdcfbc4 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -185,8 +185,13 @@ void draw_progressbar(struct gui_wps *gwps, struct skin_viewport* skin_viewport, { int minvol = sound_min(SOUND_VOLUME); int maxvol = sound_max(SOUND_VOLUME); - length = maxvol-minvol; - end = global_settings.volume-minvol; +#if defined(HAVE_PERCEPTUAL_VOLUME) || defined(HAVE_TOUCHSCREEN) + length = 1000; + end = to_normalized_volume(global_settings.volume, minvol, maxvol, length); +#else + length = maxvol - minvol; + end = global_settings.volume - minvol; +#endif } else if (pb->type == SKIN_TOKEN_BATTERY_PERCENTBAR) { -- cgit v1.2.3