From 5cc98efddcef4cb9c4a2a9c0a3ad72bd86bebd61 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Mon, 21 May 2007 13:41:43 +0000 Subject: Add %fk and %Fk WPS tags : (next) file audio frequency in KHz (rewrite of FS#6393 to adapt it to the tokenizer). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13455 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'apps/gui/gwps-common.c') diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 2429d74b86..5524c1490e 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -943,6 +943,16 @@ static char *get_token_value(struct gui_wps *gwps, snprintf(buf, buf_size, "%ld", id3->frequency); return buf; + case WPS_TOKEN_FILE_FREQUENCY_KHZ: + /* ignore remainders < 100, so 22050 Hz becomes just 22k */ + if ((id3->frequency % 1000) < 100) + snprintf(buf, buf_size, "%ld", id3->frequency / 1000); + else + snprintf(buf, buf_size, "%ld.%d", + id3->frequency / 1000, + (id3->frequency % 1000) / 100); + return buf; + case WPS_TOKEN_FILE_NAME: if (get_dir(buf, buf_size, id3->path, 0)) { /* Remove extension */ -- cgit v1.2.3