diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-07-26 23:35:00 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-07-28 16:54:33 -0400 |
commit | 78283bda64ee09502029cd2eee459fef1bd31385 (patch) | |
tree | 18ca528eec4e8610c659fd89c0d5de23ef9005d4 /apps | |
parent | 70b96193e7950391e7fcbdabad6daebe8b87e4f5 (diff) | |
download | rockbox-78283bda64ee09502029cd2eee459fef1bd31385.tar.gz rockbox-78283bda64ee09502029cd2eee459fef1bd31385.zip |
talk: Voice the volume name when browsing and when voicing full paths
Change-Id: I56660e168edd135a09cd5c021504a58ec9d40093
Diffstat (limited to 'apps')
-rw-r--r-- | apps/talk.c | 31 | ||||
-rw-r--r-- | apps/talk.h | 4 | ||||
-rw-r--r-- | apps/tree.c | 6 |
3 files changed, 38 insertions, 3 deletions
diff --git a/apps/talk.c b/apps/talk.c index 2e73001c46..ab4a97397c 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include "debug.h" | 44 | #include "debug.h" |
45 | #include "panic.h" | 45 | #include "panic.h" |
46 | #include "misc.h" /* time_split_units() */ | 46 | #include "misc.h" /* time_split_units() */ |
47 | #include "mv.h" | ||
47 | 48 | ||
48 | /***************** Constants *****************/ | 49 | /***************** Constants *****************/ |
49 | 50 | ||
@@ -1167,6 +1168,21 @@ int talk_file_or_spell(const char *dirname, const char *filename, | |||
1167 | return 0; | 1168 | return 0; |
1168 | } | 1169 | } |
1169 | 1170 | ||
1171 | #ifdef HAVE_MULTIVOLUME | ||
1172 | int talk_volume_id(int volume) | ||
1173 | { | ||
1174 | if (volume == -1) | ||
1175 | return 0; | ||
1176 | |||
1177 | int drive = volume_drive(volume); | ||
1178 | // XXX voice "VOLUME" or something like that? | ||
1179 | |||
1180 | talk_id(drive? LANG_DISK_NAME_MMC : LANG_DISK_NAME_INTERNAL, true); | ||
1181 | talk_value(volume, UNIT_INT, true); | ||
1182 | return 1; | ||
1183 | } | ||
1184 | #endif | ||
1185 | |||
1170 | /* Play a directory's .talk thumbnail, fallback to spelling the filename, or | 1186 | /* Play a directory's .talk thumbnail, fallback to spelling the filename, or |
1171 | go straight to spelling depending on settings. */ | 1187 | go straight to spelling depending on settings. */ |
1172 | int talk_dir_or_spell(const char* dirname, | 1188 | int talk_dir_or_spell(const char* dirname, |
@@ -1174,13 +1190,14 @@ int talk_dir_or_spell(const char* dirname, | |||
1174 | { | 1190 | { |
1175 | if (global_settings.talk_dir_clip) | 1191 | if (global_settings.talk_dir_clip) |
1176 | { /* .talk clips enabled */ | 1192 | { /* .talk clips enabled */ |
1177 | if(talk_file(dirname, NULL, dir_thumbnail_name, NULL, | 1193 | if (talk_file(dirname, NULL, dir_thumbnail_name, NULL, |
1178 | prefix_ids, enqueue) >0) | 1194 | prefix_ids, enqueue) >0) |
1179 | return 0; | 1195 | return 0; |
1180 | } | 1196 | } |
1181 | if (global_settings.talk_dir == TALK_SPEAK_SPELL) | 1197 | if (global_settings.talk_dir == TALK_SPEAK_SPELL) { |
1182 | /* Either .talk clips disabled or as a fallback */ | 1198 | /* Either .talk clips disabled or as a fallback */ |
1183 | return talk_spell_basename(dirname, prefix_ids, enqueue); | 1199 | return talk_spell_basename(dirname, prefix_ids, enqueue); |
1200 | } | ||
1184 | return 0; | 1201 | return 0; |
1185 | } | 1202 | } |
1186 | 1203 | ||
@@ -1201,12 +1218,20 @@ int talk_fullpath(const char* path, bool enqueue) | |||
1201 | while(ptr) { /* There are more slashes ahead */ | 1218 | while(ptr) { /* There are more slashes ahead */ |
1202 | /* temporarily poke a NULL at end of component to truncate string */ | 1219 | /* temporarily poke a NULL at end of component to truncate string */ |
1203 | *ptr = '\0'; | 1220 | *ptr = '\0'; |
1204 | talk_dir_or_spell(buf, NULL, true); | 1221 | #ifdef HAVE_MULTIVOLUME |
1222 | if (start == buf+1) { | ||
1223 | int vol = path_get_volume_id(buf+1); | ||
1224 | if (!talk_volume_id(vol)) | ||
1225 | talk_dir_or_spell(buf, NULL, true); | ||
1226 | } else | ||
1227 | #endif | ||
1228 | talk_dir_or_spell(buf, NULL, true); | ||
1205 | *ptr = '/'; /* restore string */ | 1229 | *ptr = '/'; /* restore string */ |
1206 | talk_id(VOICE_CHAR_SLASH, true); | 1230 | talk_id(VOICE_CHAR_SLASH, true); |
1207 | start = ptr+1; /* setup for next component */ | 1231 | start = ptr+1; /* setup for next component */ |
1208 | ptr = strchr(start, '/'); | 1232 | ptr = strchr(start, '/'); |
1209 | } | 1233 | } |
1234 | |||
1210 | /* no more slashes, final component is a filename */ | 1235 | /* no more slashes, final component is a filename */ |
1211 | return talk_file_or_spell(NULL, buf, NULL, true); | 1236 | return talk_file_or_spell(NULL, buf, NULL, true); |
1212 | } | 1237 | } |
diff --git a/apps/talk.h b/apps/talk.h index 6139b9ec46..507d5cbed1 100644 --- a/apps/talk.h +++ b/apps/talk.h | |||
@@ -145,6 +145,10 @@ void talk_fractional(char *tbuf, int value, int unit); | |||
145 | void talk_time(const struct tm *tm, bool enqueue); | 145 | void talk_time(const struct tm *tm, bool enqueue); |
146 | void talk_date(const struct tm *tm, bool enqueue); | 146 | void talk_date(const struct tm *tm, bool enqueue); |
147 | 147 | ||
148 | #ifdef HAVE_MULTIVOLUME | ||
149 | int talk_volume_id(int volume); | ||
150 | #endif | ||
151 | |||
148 | /* speaks hr, min, sec, ms; unit_idx is lowest or base unit of the time value */ | 152 | /* speaks hr, min, sec, ms; unit_idx is lowest or base unit of the time value */ |
149 | int talk_time_intervals(long time, int unit_idx, bool enqueue); | 153 | int talk_time_intervals(long time, int unit_idx, bool enqueue); |
150 | 154 | ||
diff --git a/apps/tree.c b/apps/tree.c index 8c41abbdcf..71a7ee3f62 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -1252,6 +1252,12 @@ static void say_filetype(int attr) | |||
1252 | 1252 | ||
1253 | static int ft_play_dirname(char* name) | 1253 | static int ft_play_dirname(char* name) |
1254 | { | 1254 | { |
1255 | #ifdef HAVE_MULTIVOLUME | ||
1256 | int vol = path_get_volume_id(name); | ||
1257 | if (talk_volume_id(vol)) | ||
1258 | return 1; | ||
1259 | #endif | ||
1260 | |||
1255 | return talk_file(tc.currdir, name, dir_thumbnail_name, NULL, | 1261 | return talk_file(tc.currdir, name, dir_thumbnail_name, NULL, |
1256 | global_settings.talk_filetype ? | 1262 | global_settings.talk_filetype ? |
1257 | TALK_IDARRAY(VOICE_DIR) : NULL, | 1263 | TALK_IDARRAY(VOICE_DIR) : NULL, |