Skin engine: respect volume decimalization
This is basically the same problem as FS#13272, except it happens on certain themes, eg. rayboradio. The issue only affects targets with decimal volume levels. Tested the fix using the rayboradio theme on the FiiO M3K and the Fuze+ simulator. Volume was displayed correctly on both. Change-Id: I9e035f7a3c04c85c9b3b01243c7f0a5f8f0ccf9f
This commit is contained in:
parent
9847f9c85e
commit
10facef17b
1 changed files with 13 additions and 1 deletions
|
@ -670,6 +670,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
{
|
{
|
||||||
int numeric_ret = -1;
|
int numeric_ret = -1;
|
||||||
const char *numeric_buf = "?";
|
const char *numeric_buf = "?";
|
||||||
|
int fmt_size;
|
||||||
|
|
||||||
if (!gwps)
|
if (!gwps)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -886,7 +887,18 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SKIN_TOKEN_VOLUME:
|
case SKIN_TOKEN_VOLUME:
|
||||||
snprintf(buf, buf_size, "%d", global_settings.volume);
|
fmt_size = format_sound_value(buf, buf_size, SOUND_VOLUME,
|
||||||
|
global_settings.volume);
|
||||||
|
/* FIXME: this is a cheap hack to avoid breaking existing themes.
|
||||||
|
* The new formatting includes a unit based on the AUDIOHW_SETTING
|
||||||
|
* definition -- on all targets, it's defined to be "dB". But the
|
||||||
|
* old formatting was just an integer value, and many themes append
|
||||||
|
* "dB" manually. So we need to strip the unit to unbreak all those
|
||||||
|
* existing themes.
|
||||||
|
*/
|
||||||
|
if(fmt_size >= 3 && !strcmp(&buf[fmt_size - 3], " dB"))
|
||||||
|
buf[fmt_size - 3] = 0;
|
||||||
|
|
||||||
if (intval)
|
if (intval)
|
||||||
{
|
{
|
||||||
int minvol = sound_min(SOUND_VOLUME);
|
int minvol = sound_min(SOUND_VOLUME);
|
||||||
|
|
Loading…
Reference in a new issue