From da4c218046f8eb871d8772ed9f2b7316e3771917 Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Wed, 7 Oct 2026 11:50:42 +0200 Subject: [PATCH] skin_engine: fix the text of five recording tags - %Rf printed the sample rate with "%lu.%1lu", a field width rather than a precision: 44100 Hz came out as "44.100", 22050 Hz as "22.50". It is now in kHz without trailing zeros: "44.1", "22.05", "48". - %Re switched on the format setting plus one, so its text named the next format: "aiff" for WAV up to nothing for MP3. It now names the format set, MP3 as "mp3" like the others. - %Rb printed the index of the MP3 bitrate setting, "12" for 128 kbps. It now prints the bitrate in kbps. Dead code from 2009 goes. - %Rm was true for stereo: rec_channels is 0 for stereo. The classic status bar has shown the mono icon for stereo recordings since 2009. - %Rn counted the minutes on past 59, so %Rh:%Rn:%Rs showed 01:61:05 after an hour. It now counts within the hour, as %Rs does. As conditionals %Rf, %Re and %Rb keep their values, so the classic status bar's sample rate, format and bitrate icons are unchanged. Co-Authored-By: Claude Opus 5.5 Change-Id: Id9fb5c0b71fc0a44c5c7b3239a74397cb71090bf --- apps/gui/skin_engine/skin_tokens.c | 86 +++++++++--------------------- 1 file changed, 24 insertions(+), 62 deletions(-) diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index ecf2a9a4fc..c215ca4046 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -1841,16 +1841,24 @@ const char *get_token_value(struct gui_wps *gwps, numeric_ret = 12; break;) } - snprintf(buf, buf_size, "%lu.%1lu", samprk/1000,samprk%1000); + /* in kHz, without trailing zeros: 44.1, 22.05, 48 */ + snprintf(buf, buf_size, "%lu.%03lu", samprk / 1000, samprk % 1000); + { + char *end = buf + strlen(buf) - 1; + while (*end == '0') + *end-- = '\0'; + if (*end == '.') + *end = '\0'; + } numeric_buf = buf; goto gtv_ret_numeric_tag_info; } case SKIN_TOKEN_REC_ENCODER: { - int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */ + /* as a conditional 1 to 4: WAV, AIFF, WV, MPEG */ if (intval) - *intval = rec_format; - switch (rec_format) + *intval = global_settings.rec_format + 1; + switch (global_settings.rec_format) { case REC_FORMAT_PCM_WAV: return "wav"; @@ -1859,74 +1867,28 @@ const char *get_token_value(struct gui_wps *gwps, case REC_FORMAT_WAVPACK: return "wv"; case REC_FORMAT_MPA_L3: - return "MP3"; + return "mp3"; default: return NULL; } break; } case SKIN_TOKEN_REC_BITRATE: - if (global_settings.rec_format == REC_FORMAT_MPA_L3) + /* MP3 only: the bitrate in kbps; as a conditional, the index of + * the setting, 1 for 8 kbps up to 18 for 320 kbps */ + if (global_settings.rec_format == REC_FORMAT_MPA_L3 && + global_settings.mp3_enc_config.bitrate < MP3_ENC_NUM_BITR) { - #if 0 /* FIXME: I dont know if this is needed? */ - switch (1<