summaryrefslogtreecommitdiff
path: root/apps/gui/gwps-common.c
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-05-14 14:33:43 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-05-14 14:33:43 +0000
commit4a6ab0d03174d7a28979380e06b6f9dfac9a7d37 (patch)
tree56c78dd5d98c9a46dfb7a08ef1d86a2310d53995 /apps/gui/gwps-common.c
parent9e94b380f0a48c41cb9d799e6ef2963210912407 (diff)
Commit FS#7164 (request is FS#6780) : Improve WPS volume enumeration. It is now the following : %?pv<Mute|...|...|0 dB|Above 0 dB>. It almost doesn't changes anything for most WPSs but adds some new possibilities. Keep in mind that some targets don't go above 0 dB so the last case might be unused.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13387 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r--apps/gui/gwps-common.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index f16a620d04..9e5329bd4f 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -837,10 +837,25 @@ static char *get_token_value(struct gui_wps *gwps,
snprintf(buf, buf_size, "%d", global_settings.volume);
if (intval)
{
- *intval = limit * (global_settings.volume
- - sound_min(SOUND_VOLUME))
- / (sound_max(SOUND_VOLUME)
- - sound_min(SOUND_VOLUME)) + 1;
+ if (global_settings.volume == sound_min(SOUND_VOLUME))
+ {
+ *intval = 1;
+ }
+ else if (global_settings.volume == 0)
+ {
+ *intval = limit - 1;
+ }
+ else if (global_settings.volume > 0)
+ {
+ *intval = limit;
+ }
+ else
+ {
+ *intval = (limit - 3) * (global_settings.volume
+ - sound_min(SOUND_VOLUME))
+ / (sound_max(SOUND_VOLUME)
+ - sound_min(SOUND_VOLUME)) + 2;
+ }
}
return buf;