voice: replace splashf with talk equivalent

Add voice equivalent to splashf messages that require
pauses between individual announcements, or that need
to include their arguments

Change-Id: Ie72326a2371f242de8999761278b22080ba33c81
This commit is contained in:
Christian Soffke 2025-06-01 00:54:18 +02:00
parent 60010b52a2
commit d9feabc720
3 changed files with 35 additions and 4 deletions

View file

@ -210,12 +210,13 @@ bool warn_on_pl_erase(void)
bool show_search_progress(bool init, int display_count, int current, int total) bool show_search_progress(bool init, int display_count, int current, int total)
{ {
static int last_tick = 0; static long last_tick, talked_tick;
/* Don't show splashes for 1/2 second after starting search */ /* Don't show splashes for 1/2 second after starting search */
if (init) if (init)
{ {
last_tick = current_tick + HZ/2; last_tick = current_tick + HZ/2;
talked_tick = 0;
return true; return true;
} }
@ -227,8 +228,18 @@ bool show_search_progress(bool init, int display_count, int current, int total)
splash_progress(current, total, str(LANG_PLAYLIST_SEARCH_MSG), splash_progress(current, total, str(LANG_PLAYLIST_SEARCH_MSG),
display_count, str(LANG_OFF_ABORT)); display_count, str(LANG_OFF_ABORT));
else else
splashf(0, ID2P(LANG_PLAYLIST_SEARCH_MSG), {
if (global_settings.talk_menu &&
TIME_AFTER(current_tick, talked_tick + (HZ * 5)))
{
talked_tick = current_tick;
talk_number(display_count, false);
talk_id(LANG_PLAYLIST_SEARCH_MSG, true);
}
/* (voiced above) */
splashf(0, str(LANG_PLAYLIST_SEARCH_MSG),
display_count, str(LANG_OFF_ABORT)); display_count, str(LANG_OFF_ABORT));
}
if (action_userabort(TIMEOUT_NOBLOCK)) if (action_userabort(TIMEOUT_NOBLOCK))
return false; return false;

View file

@ -1255,6 +1255,7 @@ bool search_playlist(void)
int found_indicies_count = 0, last_found_count = -1; int found_indicies_count = 0, last_found_count = -1;
int button; int button;
int track_display = global_settings.playlist_viewer_track_display; int track_display = global_settings.playlist_viewer_track_display;
long talked_tick = 0;
struct gui_synclist playlist_lists; struct gui_synclist playlist_lists;
struct playlist_track_info track; struct playlist_track_info track;
@ -1273,7 +1274,15 @@ bool search_playlist(void)
{ {
if (found_indicies_count != last_found_count) if (found_indicies_count != last_found_count)
{ {
splashf(0, ID2P(LANG_PLAYLIST_SEARCH_MSG), found_indicies_count, if (global_settings.talk_menu &&
TIME_AFTER(current_tick, talked_tick + (HZ * 5)))
{
talked_tick = current_tick;
talk_number(found_indicies_count, false);
talk_id(LANG_PLAYLIST_SEARCH_MSG, true);
}
/* (voiced above) */
splashf(0, str(LANG_PLAYLIST_SEARCH_MSG), found_indicies_count,
str(LANG_OFF_ABORT)); str(LANG_OFF_ABORT));
last_found_count = found_indicies_count; last_found_count = found_indicies_count;
} }

View file

@ -553,6 +553,7 @@ int presets_scan(void *viewports)
{ {
bool do_scan = true; bool do_scan = true;
int curr_freq = radio_get_current_frequency(); int curr_freq = radio_get_current_frequency();
long talked_tick = 0;
struct viewport *vp = (struct viewport *)viewports; struct viewport *vp = (struct viewport *)viewports;
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
@ -581,7 +582,15 @@ int presets_scan(void *viewports)
frac = freq % 100; frac = freq % 100;
freq /= 100; freq /= 100;
splashf(0, ID2P(LANG_FM_SCANNING), freq, frac); if (global_settings.talk_menu &&
TIME_AFTER(current_tick, talked_tick + (HZ * 5)))
{
talked_tick = current_tick;
talk_id(LANG_FM_SCANNING, false);
talk_value_decimal(curr_freq, UNIT_INT, 6, true);
}
/* (voiced above) */
splashf(0, str(LANG_FM_SCANNING), freq, frac);
if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq)) if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq))
{ {
@ -592,6 +601,8 @@ int presets_scan(void *viewports)
} }
curr_freq += fmr->freq_step; curr_freq += fmr->freq_step;
yield(); /* (voice_thread) */
} }
radio_set_current_frequency(curr_freq); radio_set_current_frequency(curr_freq);