mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-09 23:53:28 -04:00
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 <noreply@anthropic.com> Change-Id: Id9fb5c0b71fc0a44c5c7b3239a74397cb71090bf
This commit is contained in:
parent
776fe2ad9c
commit
da4c218046
1 changed files with 24 additions and 62 deletions
|
|
@ -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<<global_settings.mp3_enc_config.bitrate)
|
||||
{
|
||||
case MP3_BITR_CAP_8:
|
||||
numeric_ret = 1;
|
||||
break;
|
||||
case MP3_BITR_CAP_16:
|
||||
numeric_ret = 2;
|
||||
break;
|
||||
case MP3_BITR_CAP_24:
|
||||
numeric_ret = 3;
|
||||
break;
|
||||
case MP3_BITR_CAP_32:
|
||||
numeric_ret = 4;
|
||||
break;
|
||||
case MP3_BITR_CAP_40:
|
||||
numeric_ret = 5;
|
||||
break;
|
||||
case MP3_BITR_CAP_48:
|
||||
numeric_ret = 6;
|
||||
break;
|
||||
case MP3_BITR_CAP_56:
|
||||
numeric_ret = 7;
|
||||
break;
|
||||
case MP3_BITR_CAP_64:
|
||||
numeric_ret = 8;
|
||||
break;
|
||||
case MP3_BITR_CAP_80:
|
||||
numeric_ret = 9;
|
||||
break;
|
||||
case MP3_BITR_CAP_96:
|
||||
numeric_ret = 10;
|
||||
break;
|
||||
case MP3_BITR_CAP_112:
|
||||
numeric_ret = 11;
|
||||
break;
|
||||
case MP3_BITR_CAP_128:
|
||||
numeric_ret = 12;
|
||||
break;
|
||||
case MP3_BITR_CAP_144:
|
||||
numeric_ret = 13;
|
||||
break;
|
||||
case MP3_BITR_CAP_160:
|
||||
numeric_ret = 14;
|
||||
break;
|
||||
case MP3_BITR_CAP_192:
|
||||
numeric_ret = 15;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
numeric_ret = global_settings.mp3_enc_config.bitrate+1;
|
||||
snprintf(buf, buf_size, "%lu", global_settings.mp3_enc_config.bitrate+1);
|
||||
unsigned long index = global_settings.mp3_enc_config.bitrate;
|
||||
numeric_ret = index + 1;
|
||||
snprintf(buf, buf_size, "%lu", mp3_enc_bitr[index]);
|
||||
numeric_buf = buf;
|
||||
goto gtv_ret_numeric_tag_info;
|
||||
}
|
||||
else
|
||||
return NULL; /* Fixme later */
|
||||
return NULL;
|
||||
|
||||
case SKIN_TOKEN_REC_MONO:
|
||||
if (!global_settings.rec_channels)
|
||||
if (global_settings.rec_channels) /* 0 stereo, 1 mono */
|
||||
return "m";
|
||||
return NULL;
|
||||
|
||||
|
|
@ -1940,7 +1902,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
|||
}
|
||||
case SKIN_TOKEN_REC_MINUTES:
|
||||
{
|
||||
int time = (audio_recorded_time() / HZ) / 60;
|
||||
int time = (audio_recorded_time() / HZ) / 60 % 60;
|
||||
numeric_ret = time;
|
||||
snprintf(buf, buf_size, "%02d", numeric_ret);
|
||||
numeric_buf = buf;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue