diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-11-22 23:21:48 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-22 22:10:46 +0000 |
commit | dd2a0aeab03aa3f014411ef63d08d295a45cc3de (patch) | |
tree | 2d5441b19f6b910408f9e594b5172ddf2b2482d6 /apps/gui | |
parent | 82e26ff2e443fec8afaeaa3f5f809f223717c835 (diff) | |
download | rockbox-dd2a0aeab03aa3f014411ef63d08d295a45cc3de.tar.gz rockbox-dd2a0aeab03aa3f014411ef63d08d295a45cc3de.zip |
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
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 9 | ||||
-rw-r--r-- | apps/gui/wps.c | 4 |
2 files changed, 9 insertions, 4 deletions
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, | |||
185 | { | 185 | { |
186 | int minvol = sound_min(SOUND_VOLUME); | 186 | int minvol = sound_min(SOUND_VOLUME); |
187 | int maxvol = sound_max(SOUND_VOLUME); | 187 | int maxvol = sound_max(SOUND_VOLUME); |
188 | length = maxvol-minvol; | 188 | #if defined(HAVE_PERCEPTUAL_VOLUME) || defined(HAVE_TOUCHSCREEN) |
189 | end = global_settings.volume-minvol; | 189 | length = 1000; |
190 | end = to_normalized_volume(global_settings.volume, minvol, maxvol, length); | ||
191 | #else | ||
192 | length = maxvol - minvol; | ||
193 | end = global_settings.volume - minvol; | ||
194 | #endif | ||
190 | } | 195 | } |
191 | else if (pb->type == SKIN_TOKEN_BATTERY_PERCENTBAR) | 196 | else if (pb->type == SKIN_TOKEN_BATTERY_PERCENTBAR) |
192 | { | 197 | { |
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index fe656034b9..d35a5ac6d2 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -182,8 +182,8 @@ static int skintouch_to_wps(void) | |||
182 | const int min_vol = sound_min(SOUND_VOLUME); | 182 | const int min_vol = sound_min(SOUND_VOLUME); |
183 | const int max_vol = sound_max(SOUND_VOLUME); | 183 | const int max_vol = sound_max(SOUND_VOLUME); |
184 | const int step_vol = sound_steps(SOUND_VOLUME); | 184 | const int step_vol = sound_steps(SOUND_VOLUME); |
185 | global_settings.volume = (offset * (max_vol - min_vol)) / 1000; | 185 | |
186 | global_settings.volume += min_vol; | 186 | global_settings.volume = from_normalized_volume(offset, min_vol, max_vol, 1000); |
187 | global_settings.volume -= (global_settings.volume % step_vol); | 187 | global_settings.volume -= (global_settings.volume % step_vol); |
188 | setvol(); | 188 | setvol(); |
189 | } | 189 | } |