mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
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
This commit is contained in:
parent
82e26ff2e4
commit
dd2a0aeab0
2 changed files with 9 additions and 4 deletions
|
|
@ -185,8 +185,13 @@ void draw_progressbar(struct gui_wps *gwps, struct skin_viewport* skin_viewport,
|
||||||
{
|
{
|
||||||
int minvol = sound_min(SOUND_VOLUME);
|
int minvol = sound_min(SOUND_VOLUME);
|
||||||
int maxvol = sound_max(SOUND_VOLUME);
|
int maxvol = sound_max(SOUND_VOLUME);
|
||||||
length = maxvol-minvol;
|
#if defined(HAVE_PERCEPTUAL_VOLUME) || defined(HAVE_TOUCHSCREEN)
|
||||||
end = global_settings.volume-minvol;
|
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)
|
else if (pb->type == SKIN_TOKEN_BATTERY_PERCENTBAR)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -182,8 +182,8 @@ static int skintouch_to_wps(void)
|
||||||
const int min_vol = sound_min(SOUND_VOLUME);
|
const int min_vol = sound_min(SOUND_VOLUME);
|
||||||
const int max_vol = sound_max(SOUND_VOLUME);
|
const int max_vol = sound_max(SOUND_VOLUME);
|
||||||
const int step_vol = sound_steps(SOUND_VOLUME);
|
const int step_vol = sound_steps(SOUND_VOLUME);
|
||||||
global_settings.volume = (offset * (max_vol - min_vol)) / 1000;
|
|
||||||
global_settings.volume += min_vol;
|
global_settings.volume = from_normalized_volume(offset, min_vol, max_vol, 1000);
|
||||||
global_settings.volume -= (global_settings.volume % step_vol);
|
global_settings.volume -= (global_settings.volume % step_vol);
|
||||||
setvol();
|
setvol();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue