1
0
Fork 0
forked from len0rd/rockbox

talk: Voice the volume name when browsing and when voicing full paths

Change-Id: I56660e168edd135a09cd5c021504a58ec9d40093
This commit is contained in:
Solomon Peachy 2024-07-26 23:35:00 -04:00
parent 70b96193e7
commit 78283bda64
5 changed files with 68 additions and 4 deletions

View file

@ -127,7 +127,35 @@ void init_volume_names(void)
VOL_START_TOK, voldec, volume, VOL_END_TOK);
DEBUGF("vol<%d> = %s ", volume, buffer);
}
DEBUGF("\n");
DEBUGF("\n");
}
#include <stdio.h>
int path_get_volume_id(const char *name)
{
int v = -1;
if (!name || *name != VOL_START_TOK)
goto bail;
do {
switch (*name)
{
case '0' ... '9': /* digit; parse volume number */
v = (v * 10 + *name - '0') % VOL_NUM_MAX;
break;
case '\0':
case PATH_SEPCH: /* no closing bracket; no volume */
v = -1;
goto bail;
default: /* something else; reset volume */
v = 0;
}
} while (*++name != VOL_END_TOK); /* found end token? */
bail:
return v;
}
/* Returns on which volume this is and sets *nameptr to the portion of the