summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine/skin_tokens.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/skin_engine/skin_tokens.c')
-rw-r--r--apps/gui/skin_engine/skin_tokens.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index eff972858d..794d7f4456 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -135,16 +135,16 @@ static char* get_dir(char* buf, int buf_size, const char* path, int level)
135*/ 135*/
136static int pitch_speed_enum(int range, int32_t val, int32_t normval) 136static int pitch_speed_enum(int range, int32_t val, int32_t normval)
137{ 137{
138 int center; 138 int center;
139 int n; 139 int n;
140 140
141 if (range < 3) 141 if (range < 3)
142 return (val == normval) + 1; 142 return (val == normval) + 1;
143 if (val == normval) 143 if (val == normval)
144 return range; 144 return range;
145 center = range / 2; 145 center = range / 2;
146 n = (center * val) / normval + 1; 146 n = (center * val) / normval + 1;
147 return (range <= n) ? (range - 1) : n; 147 return (range <= n) ? (range - 1) : n;
148} 148}
149#endif 149#endif
150 150
@@ -415,8 +415,8 @@ const char *get_token_value(struct gui_wps *gwps,
415 case WPS_TOKEN_ALBUMART_DISPLAY: 415 case WPS_TOKEN_ALBUMART_DISPLAY:
416 if (!data->albumart) 416 if (!data->albumart)
417 return NULL; 417 return NULL;
418 if (!data->albumart->draw) 418 if (!data->albumart->draw)
419 data->albumart->draw = true; 419 data->albumart->draw = true;
420 return NULL; 420 return NULL;
421#endif 421#endif
422 422
@@ -549,10 +549,10 @@ const char *get_token_value(struct gui_wps *gwps,
549 } 549 }
550#endif 550#endif
551#ifdef HAVE_USB_POWER 551#ifdef HAVE_USB_POWER
552 case WPS_TOKEN_USB_POWERED: 552 case WPS_TOKEN_USB_POWERED:
553 if (usb_powered()) 553 if (usb_powered())
554 return "u"; 554 return "u";
555 return NULL; 555 return NULL;
556#endif 556#endif
557 case WPS_TOKEN_BATTERY_SLEEPTIME: 557 case WPS_TOKEN_BATTERY_SLEEPTIME:
558 { 558 {
@@ -836,32 +836,32 @@ const char *get_token_value(struct gui_wps *gwps,
836 int32_t pitch = sound_get_pitch(); 836 int32_t pitch = sound_get_pitch();
837 snprintf(buf, buf_size, "%ld.%ld", 837 snprintf(buf, buf_size, "%ld.%ld",
838 pitch / PITCH_SPEED_PRECISION, 838 pitch / PITCH_SPEED_PRECISION,
839 (pitch % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); 839 (pitch % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10));
840 840
841 if (intval) 841 if (intval)
842 *intval = pitch_speed_enum(limit, pitch, 842 *intval = pitch_speed_enum(limit, pitch,
843 PITCH_SPEED_PRECISION * 100); 843 PITCH_SPEED_PRECISION * 100);
844 return buf; 844 return buf;
845 } 845 }
846#endif 846#endif
847 847
848#if CONFIG_CODEC == SWCODEC 848#if CONFIG_CODEC == SWCODEC
849 case WPS_TOKEN_SOUND_SPEED: 849 case WPS_TOKEN_SOUND_SPEED:
850 { 850 {
851 int32_t pitch = sound_get_pitch(); 851 int32_t pitch = sound_get_pitch();
852 int32_t speed; 852 int32_t speed;
853 if (dsp_timestretch_available()) 853 if (dsp_timestretch_available())
854 speed = GET_SPEED(pitch, dsp_get_timestretch()); 854 speed = GET_SPEED(pitch, dsp_get_timestretch());
855 else 855 else
856 speed = pitch; 856 speed = pitch;
857 snprintf(buf, buf_size, "%ld.%ld", 857 snprintf(buf, buf_size, "%ld.%ld",
858 speed / PITCH_SPEED_PRECISION, 858 speed / PITCH_SPEED_PRECISION,
859 (speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); 859 (speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10));
860 if (intval) 860 if (intval)
861 *intval = pitch_speed_enum(limit, speed, 861 *intval = pitch_speed_enum(limit, speed,
862 PITCH_SPEED_PRECISION * 100); 862 PITCH_SPEED_PRECISION * 100);
863 return buf; 863 return buf;
864 } 864 }
865#endif 865#endif
866 866
867 case WPS_TOKEN_MAIN_HOLD: 867 case WPS_TOKEN_MAIN_HOLD:
@@ -1122,7 +1122,7 @@ const char *get_token_value(struct gui_wps *gwps,
1122 break; 1122 break;
1123 } 1123 }
1124 #endif 1124 #endif
1125 *intval = global_settings.mp3_enc_config.bitrate+1; 1125 *intval = global_settings.mp3_enc_config.bitrate+1;
1126 } 1126 }
1127 snprintf(buf, buf_size, "%d", global_settings.mp3_enc_config.bitrate+1); 1127 snprintf(buf, buf_size, "%d", global_settings.mp3_enc_config.bitrate+1);
1128 return buf; 1128 return buf;
@@ -1136,9 +1136,9 @@ const char *get_token_value(struct gui_wps *gwps,
1136 return buf; 1136 return buf;
1137#endif 1137#endif
1138 case WPS_TOKEN_REC_MONO: 1138 case WPS_TOKEN_REC_MONO:
1139 if (!global_settings.rec_channels) 1139 if (!global_settings.rec_channels)
1140 return "m"; 1140 return "m";
1141 return NULL; 1141 return NULL;
1142 1142
1143#endif /* HAVE_RECORDING */ 1143#endif /* HAVE_RECORDING */
1144 case WPS_TOKEN_CURRENT_SCREEN: 1144 case WPS_TOKEN_CURRENT_SCREEN: