voice: splash_progress

Says "Loading x%" in previously unvoiced splash_progress

Change-Id: I81780e3baf6ea8a8871a4433e1a733100b8cd5f6
This commit is contained in:
Christian Soffke 2025-05-28 12:14:53 +02:00
parent a001d76afe
commit c51ca1eeb5
5 changed files with 22 additions and 14 deletions

View file

@ -36,7 +36,7 @@
#include "misc.h" /* get_current_activity */
#endif
static long progress_next_tick = 0;
static long progress_next_tick, talked_tick;
#define MAXLINES (LCD_HEIGHT/6)
#define MAXBUFFER 512
@ -247,6 +247,7 @@ void splashf(int ticks, const char *fmt, ...)
void splash_progress_set_delay(long delay_ticks)
{
progress_next_tick = current_tick + delay_ticks;
talked_tick = 0;
}
/* splash a progress meter */
@ -266,6 +267,15 @@ void splash_progress(int current, int total, const char *fmt, ...)
vp_flag = 0; /* don't mark vp dirty to prevent flashing */
}
if (global_settings.talk_menu &&
total > 0 &&
TIME_AFTER(current_tick, talked_tick + HZ*5))
{
talked_tick = current_tick;
talk_ids(false, LANG_LOADING_PERCENT,
TALK_ID(current * 100 / total, UNIT_PERCENT));
}
/* If fmt is a lang ID then get the corresponding string (which
still might contain % place holders). */
fmt = P2STR((unsigned char *)fmt);

View file

@ -223,10 +223,9 @@ bool show_search_progress(bool init, int display_count, int current, int total)
if (TIME_AFTER(current_tick, last_tick + HZ/10))
{
if (total != current)
{
/* (voiced) */
splash_progress(current, total, str(LANG_PLAYLIST_SEARCH_MSG),
display_count, str(LANG_OFF_ABORT));
}
else
splashf(0, ID2P(LANG_PLAYLIST_SEARCH_MSG),
display_count, str(LANG_OFF_ABORT));

View file

@ -420,22 +420,14 @@ static int pt_add_track(int i, enum ePT_SUM section, struct playing_time_info *p
{
struct mp3entry id3;
struct playlist_track_info pl_track;
static unsigned long talked_tick;
int progress_total = pti->remaining_only ?
(pti->nb_tracks - pti->curr_display_index) + 1 :
pti->nb_tracks;
/* (voiced) */
rb->splash_progress(pti->counted, progress_total, "%s (%s)",
rb->str(LANG_WAIT), rb->str(LANG_OFF_ABORT));
if (rb->global_settings->talk_menu && TIME_AFTER(*rb->current_tick, talked_tick + HZ*5))
{
talked_tick = *rb->current_tick;
rb_talk_ids(false, LANG_LOADING_PERCENT,
TALK_ID(pti->counted * 100 / progress_total,
UNIT_PERCENT));
}
if (rb->action_userabort(TIMEOUT_NOBLOCK))
return -1;
else if (rb->playlist_get_track_info(NULL, i, &pl_track) < 0

View file

@ -238,6 +238,10 @@ static int browser(void* param)
}
if (stat->commit_step > 0)
{
/* (prevent redundant voicing by splash_progress */
bool tmp = global_settings.talk_menu;
global_settings.talk_menu = false;
if (lang_is_rtl())
{
splash_progress(stat->commit_step,
@ -254,6 +258,7 @@ static int browser(void* param)
stat->commit_step,
tagcache_get_max_commit_step());
}
global_settings.talk_menu = tmp;
}
else
{

View file

@ -2415,7 +2415,8 @@ static bool insert_all_playlist(struct tree_context *c,
{
if (TIME_AFTER(current_tick, last_tick + HZ/4))
{
splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT)); // XXX not voiced
/* (voiced) */
splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT));
if (action_userabort(TIMEOUT_NOBLOCK))
{
exit_loop_now = true;
@ -2593,7 +2594,8 @@ bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name))
n = tc->filesindir;
for (i = 0; i < n; i++)
{
splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT)); // XXX not voiced
/* (voiced) */
splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT));
if (TIME_AFTER(current_tick, last_tick + HZ/4))
{
if (action_userabort(TIMEOUT_NOBLOCK))