From 0070f60441bac95a674c4c5511b652c9a62d8ce7 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 15 Oct 2009 22:22:07 +0000 Subject: Fix %Sp expansion in wps The value returned from sound_get_pitch() was shown assuming that 100% corresponds to 1000 by skin_tokens.c::get_token_value(). The value actually is 100*PITCH_SPEED_PRECISION. Steal the way the callchain from gui_syncpitchscreen_run() to pitchscreen_draw() in apps/gui/pitchscreen.c formats the value and use it here for consistency. Flyspray: FS#10673 Author: Junio C Hamano git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23199 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_tokens.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index e0d4595122..ad4613ed99 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -717,9 +717,10 @@ const char *get_token_value(struct gui_wps *gwps, #if (CONFIG_CODEC != MAS3507D) case WPS_TOKEN_SOUND_PITCH: { - int val = sound_get_pitch(); - snprintf(buf, buf_size, "%d.%d", - val / 10, val % 10); + int32_t pitch = sound_get_pitch(); + snprintf(buf, buf_size, "%ld.%ld", + pitch / PITCH_SPEED_PRECISION, + (pitch % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); return buf; } #endif -- cgit v1.2.3