From 39f86858c4d14069621b490356a03b781e7c8bfb Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 17 May 2025 17:33:46 -0400 Subject: [PATCH] voice: Convert a pile of splashf() messages to be voiced Basically, this just replaces str(STRID) with ID2P(STRID). The voiced version of these strings cannot not have any format specifiers (enforced by the language tooling) and are instead more generic. As many of these are error conditions, it is doubly important for them to be voiced in some way. There are some places in the code that perform their own voicing for splash messages (eg the shutdown code); those are left alone. Change-Id: I7d51af351e8fa5c4beee42fbfc02719f1d6591b8 --- apps/alarm_menu.c | 2 +- apps/filetree.c | 12 ++++++------ apps/gui/skin_engine/skin_parser.c | 4 ++-- apps/misc.c | 2 +- apps/open_plugin.c | 2 +- apps/playlist.c | 2 +- apps/playlist_catalog.c | 4 ++-- apps/playlist_viewer.c | 2 +- apps/plugins/mikmod/mikmod.c | 2 +- apps/plugins/open_plugins.c | 4 ++-- apps/plugins/vbrfix.c | 2 +- apps/radio/presets.c | 2 +- apps/root_menu.c | 2 +- apps/tagtree.c | 14 +++++++------- apps/talk.c | 2 +- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c index 67f8d1e8dd..c2f2422aea 100644 --- a/apps/alarm_menu.c +++ b/apps/alarm_menu.c @@ -74,7 +74,7 @@ int alarm_screen(void) talk_value(mins_togo % 60, UNIT_MIN, true); talk_force_enqueue_next(); } - splashf(HZ*2, str(LANG_ALARM_MOD_TIME_TO_GO), + splashf(HZ*2, ID2P(LANG_ALARM_MOD_TIME_TO_GO), mins_togo / 60, mins_togo % 60); } else { splash(HZ, ID2P(LANG_ALARM_MOD_ERROR)); diff --git a/apps/filetree.c b/apps/filetree.c index 4d682166d0..d6528d632a 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -122,7 +122,7 @@ int ft_build_playlist(struct tree_context* c, int start_index) } cpu_boost(false); } - + playlist_insert_context_release(&pl_context); tree_unlock_cache(c); @@ -455,7 +455,7 @@ static void ft_load_font(char *file) int current_font_id; enum screen_type screen = SCREEN_MAIN; #if NB_SCREENS > 1 - MENUITEM_STRINGLIST(menu, ID2P(LANG_CUSTOM_FONT), NULL, + MENUITEM_STRINGLIST(menu, ID2P(LANG_CUSTOM_FONT), NULL, ID2P(LANG_MAIN_SCREEN), ID2P(LANG_REMOTE_SCREEN)) switch (do_menu(&menu, NULL, NULL, false)) { @@ -560,7 +560,7 @@ int ft_enter(struct tree_context* c) struct entry* file = tree_get_entry_at(c, c->selected_item); if (!file) { - splashf(HZ, str(LANG_READ_FAILED), str(LANG_UNKNOWN)); + splashf(HZ, ID2P(LANG_READ_FAILED), str(LANG_UNKNOWN)); return rc; } @@ -602,7 +602,7 @@ int ft_enter(struct tree_context* c) if (!warn_on_pl_erase()) break; - if (global_settings.party_mode && audio_status()) + if (global_settings.party_mode && audio_status()) { playlist_insert_track(NULL, buf, PLAYLIST_INSERT_LAST, true, true); @@ -768,7 +768,7 @@ int ft_enter(struct tree_context* c) file = tree_get_entry_at(c, c->selected_item); if (!file) { - splashf(HZ, str(LANG_READ_FAILED), str(LANG_UNKNOWN)); + splashf(HZ, ID2P(LANG_READ_FAILED), str(LANG_UNKNOWN)); return rc; } @@ -833,7 +833,7 @@ int ft_exit(struct tree_context* c) extern char lastfile[]; /* from tree.c */ char buf[MAX_PATH]; int rc = 0; - bool exit_func = false; + bool exit_func = false; int i = strlen(c->currdir); /* strip trailing slashes */ diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index ec043aef48..30de273024 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -2173,7 +2173,7 @@ static bool skin_load_fonts(struct wps_data *data) { if (success) { - splashf(HZ, str(LANG_FONT_LOAD_ERROR), "(no name)"); + splashf(HZ, ID2P(LANG_FONT_LOAD_ERROR), "(no name)"); DEBUGF("font %d not specified\n", font_id); } success = false; @@ -2198,7 +2198,7 @@ static bool skin_load_fonts(struct wps_data *data) if (font->id < 0) { - splashf(HZ, str(LANG_FONT_LOAD_ERROR), font->name); + splashf(HZ, ID2P(LANG_FONT_LOAD_ERROR), font->name); DEBUGF("Unable to load font %d: '%s'\n", font_id, font->name); font->name = NULL; /* to stop trying to load it again if we fail */ success = false; diff --git a/apps/misc.c b/apps/misc.c index 8ce8ccbfa5..4eea46a9f0 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -222,7 +222,7 @@ bool show_search_progress(bool init, int display_count, int current, int total) display_count, str(LANG_OFF_ABORT)); } else - splashf(0, str(LANG_PLAYLIST_SEARCH_MSG), + splashf(0, ID2P(LANG_PLAYLIST_SEARCH_MSG), display_count, str(LANG_OFF_ABORT)); if (action_userabort(TIMEOUT_NOBLOCK)) diff --git a/apps/open_plugin.c b/apps/open_plugin.c index b09fa6a1a4..9976e5b77c 100644 --- a/apps/open_plugin.c +++ b/apps/open_plugin.c @@ -348,7 +348,7 @@ uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *p logf("OP add_path Invalid, *Clearing entry*"); if (lang_id != LANG_SHORTCUTS) /* from shortcuts menu */ - splashf(HZ * 2, str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos); + splashf(HZ * 2, ID2P(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos); op_clear_entry(op_entry); return 0; } diff --git a/apps/playlist.c b/apps/playlist.c index a55fe89918..aafc56db11 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -684,7 +684,7 @@ static void display_playlist_count(int count, const unsigned char *fmt, } } - splashf(0, P2STR(fmt), count, str(LANG_OFF_ABORT)); + splashf(0, fmt, count, str(LANG_OFF_ABORT)); } /* diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index e23fc0746b..ace01f541a 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c @@ -100,7 +100,7 @@ static int initialize_catalog_buf(char* dirbuf, size_t dirbuf_sz) talk_dir_or_spell(dirbuf, NULL, true); talk_force_enqueue_next(); } - splashf(HZ*2, str(LANG_CATALOG_NO_DIRECTORY), dirbuf); + splashf(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY), dirbuf); return -1; } else { @@ -265,7 +265,7 @@ static void display_insert_count(int count) talk_id(LANG_PLAYLIST_INSERT_COUNT, true); } - splashf(0, str(LANG_PLAYLIST_INSERT_COUNT), count, str(LANG_OFF_ABORT)); + splashf(0, ID2P(LANG_PLAYLIST_INSERT_COUNT), count, str(LANG_OFF_ABORT)); } /* Add specified track into playlist. Callback from directory insert */ diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 3cb1047583..f51fdf3def 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -1271,7 +1271,7 @@ bool search_playlist(void) { if (found_indicies_count != last_found_count) { - splashf(0, str(LANG_PLAYLIST_SEARCH_MSG), found_indicies_count, + splashf(0, ID2P(LANG_PLAYLIST_SEARCH_MSG), found_indicies_count, str(LANG_OFF_ABORT)); last_found_count = found_indicies_count; } diff --git a/apps/plugins/mikmod/mikmod.c b/apps/plugins/mikmod/mikmod.c index d80a69a8a6..4bc75374ac 100644 --- a/apps/plugins/mikmod/mikmod.c +++ b/apps/plugins/mikmod/mikmod.c @@ -711,7 +711,7 @@ static void mm_errorhandler(void) rb->talk_value_decimal(MikMod_errno, UNIT_INT, 0, true); rb->talk_force_enqueue_next(); } - rb->splashf(HZ, rb->str(LANG_ERROR_FORMATSTR), MikMod_strerror(MikMod_errno)); + rb->splashf(HZ, ID2P(LANG_ERROR_FORMATSTR), MikMod_strerror(MikMod_errno)); quit = true; } diff --git a/apps/plugins/open_plugins.c b/apps/plugins/open_plugins.c index c09ddf99aa..164b6e700b 100644 --- a/apps/plugins/open_plugins.c +++ b/apps/plugins/open_plugins.c @@ -361,7 +361,7 @@ static uint32_t op_entry_add_path(const char *key, const char *plugin, const cha plugin = rb->filetype_get_plugin(fattr, buf, sizeof(buf)); if (!plugin) { - rb->splashf(HZ * 2, rb->str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos); + rb->splashf(HZ * 2, ID2P(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos); return 0; } } @@ -420,7 +420,7 @@ static uint32_t op_entry_add_path(const char *key, const char *plugin, const cha else { if (op_entry.lang_id != LANG_SHORTCUTS) - rb->splashf(HZ * 2, rb->str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos); + rb->splashf(HZ * 2, ID2P(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos); return 0; } } diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c index 622a0a4f07..7b7aeb5ed4 100644 --- a/apps/plugins/vbrfix.c +++ b/apps/plugins/vbrfix.c @@ -130,7 +130,7 @@ static void fileerror(int rc) rb->talk_force_enqueue_next(); } - rb->splashf(HZ*2, rb->str(LANG_FILE_ERROR), rc); + rb->splashf(HZ*2, ID2P(LANG_FILE_ERROR), rc); } static const unsigned char empty_id3_header[] = diff --git a/apps/radio/presets.c b/apps/radio/presets.c index 1a748e9f88..cb95f80027 100644 --- a/apps/radio/presets.c +++ b/apps/radio/presets.c @@ -581,7 +581,7 @@ int presets_scan(void *viewports) frac = freq % 100; freq /= 100; - splashf(0, str(LANG_FM_SCANNING), freq, frac); + splashf(0, ID2P(LANG_FM_SCANNING), freq, frac); if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq)) { diff --git a/apps/root_menu.c b/apps/root_menu.c index b39f1acaa6..4c4b9bf13f 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -257,7 +257,7 @@ static int browser(void* param) } else { - splashf(0, str(LANG_BUILDING_DATABASE), + splashf(0, ID2P(LANG_BUILDING_DATABASE), stat->processed_entries); } } diff --git a/apps/tagtree.c b/apps/tagtree.c index 0163675cae..049d0c6455 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -1065,7 +1065,7 @@ int tagtree_export(void) { struct tagcache_search tcs; - splash(0, str(LANG_CREATING)); + splash(0, ID2P(LANG_CREATING)); if (!tagcache_create_changelog(&tcs)) { splash(HZ*2, ID2P(LANG_FAILED)); @@ -1872,7 +1872,7 @@ entry_skip_formatter: talk_value(total_count, UNIT_INT, true); } - splashf(HZ*4, str(LANG_SHOWDIR_BUFFER_FULL), total_count); + splashf(HZ*4, ID2P(LANG_SHOWDIR_BUFFER_FULL), total_count); logf("Too small dir buffer"); return 0; } @@ -2012,10 +2012,10 @@ int tagtree_load(struct tree_context* c) if (count < 0) { if (count != RELOAD_TAGTREE) - splash(HZ, str(LANG_TAGCACHE_BUSY)); + splash(HZ, ID2P(LANG_TAGCACHE_BUSY)); else /* unload and re-init tagtree */ { - splash(HZ, str(LANG_WAIT)); + splash(HZ, ID2P(LANG_WAIT)); tagtree_unload(c); if (!initialize_tagtree()) return 0; @@ -2404,7 +2404,7 @@ static bool insert_all_playlist(struct tree_context *c, n, slots_remaining); talk_id(LANG_RANDOM_SHUFFLE_RANDOM_SELECTIVE_SONGS_SUMMARY, true); - splashf(HZ * 2, str(LANG_RANDOM_SHUFFLE_RANDOM_SELECTIVE_SONGS_SUMMARY), + splashf(HZ * 2, ID2P(LANG_RANDOM_SHUFFLE_RANDOM_SELECTIVE_SONGS_SUMMARY), slots_remaining); } } @@ -2414,7 +2414,7 @@ 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)); + splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT)); // XXX not voiced if (action_userabort(TIMEOUT_NOBLOCK)) { exit_loop_now = true; @@ -2592,7 +2592,7 @@ 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)); + splash_progress(i, n, "%s (%s)", str(LANG_WAIT), str(LANG_OFF_ABORT)); // XXX not voiced if (TIME_AFTER(current_tick, last_tick + HZ/4)) { if (action_userabort(TIMEOUT_NOBLOCK)) diff --git a/apps/talk.c b/apps/talk.c index 50fa21d650..38e9cb264c 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -926,7 +926,7 @@ void talk_init(void) if (!load_voicefile_index(filehandle)) { if (global_settings.talk_menu) - splashf(HZ, str(LANG_READ_FAILED), ".voice"); + splashf(HZ, ID2P(LANG_READ_FAILED), ".voice"); goto out; } /* Now determine the maximum buffer size needed for the voicefile.