1
0
Fork 0
forked from len0rd/rockbox

Fixed voice prompts from id3 db

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9882 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Hardeep Sidhu 2006-05-07 06:16:17 +00:00
parent 33bd218010
commit a95068cf39

View file

@ -808,7 +808,21 @@ static bool dirbrowse(void)
TIME_AFTER(current_tick, thumbnail_time)) TIME_AFTER(current_tick, thumbnail_time))
{ /* a delayed hovering thumbnail is due now */ { /* a delayed hovering thumbnail is due now */
int res; int res;
if (dircache[lasti].attr & ATTR_DIRECTORY) int attr;
char* name;
if (id3db)
{
attr = tagtree_get_attr(&tc);
name = tagtree_get_entry(&tc, lasti)->name;
}
else
{
attr = dircache[lasti].attr;
name = dircache[lasti].name;
}
if (attr & ATTR_DIRECTORY)
{ {
DEBUGF("Playing directory thumbnail: %s", currdir); DEBUGF("Playing directory thumbnail: %s", currdir);
res = ft_play_dirname(lasti); res = ft_play_dirname(lasti);
@ -821,11 +835,11 @@ static bool dirbrowse(void)
else else
{ {
DEBUGF("Playing file thumbnail: %s/%s%s\n", DEBUGF("Playing file thumbnail: %s/%s%s\n",
currdir, dircache[lasti].name, currdir, name,
file_thumbnail_ext); file_thumbnail_ext);
/* no fallback necessary, we knew in advance /* no fallback necessary, we knew in advance
that the file exists */ that the file exists */
ft_play_filename(currdir, dircache[lasti].name); ft_play_filename(currdir, name);
} }
thumbnail_time = -1; /* job done */ thumbnail_time = -1; /* job done */
} }
@ -939,12 +953,26 @@ static bool dirbrowse(void)
if ( numentries > 0 ) { if ( numentries > 0 ) {
/* Voice the file if changed */ /* Voice the file if changed */
if(lasti != tc.selected_item || restore) { if(lasti != tc.selected_item || restore) {
int attr;
char* name;
lasti = tc.selected_item; lasti = tc.selected_item;
thumbnail_time = -1; /* Cancel whatever we were thumbnail_time = -1; /* Cancel whatever we were
about to say */ about to say */
if (id3db)
{
attr = tagtree_get_attr(&tc);
name = tagtree_get_entry(&tc, tc.selected_item)->name;
}
else
{
attr = dircache[tc.selected_item].attr;
name = dircache[tc.selected_item].name;
}
/* Directory? */ /* Directory? */
if (dircache[tc.selected_item].attr & ATTR_DIRECTORY) if (attr & ATTR_DIRECTORY)
{ {
/* play directory thumbnail */ /* play directory thumbnail */
switch (global_settings.talk_dir) { switch (global_settings.talk_dir) {
@ -954,8 +982,7 @@ static bool dirbrowse(void)
break; break;
case 2: /* dirs spelled */ case 2: /* dirs spelled */
talk_spell(dircache[tc.selected_item].name, talk_spell(name, false);
false);
break; break;
case 3: /* thumbnail clip */ case 3: /* thumbnail clip */
@ -974,25 +1001,21 @@ static bool dirbrowse(void)
case 1: /* files as numbers */ case 1: /* files as numbers */
ft_play_filenumber( ft_play_filenumber(
tc.selected_item-tc.dirsindir+1, tc.selected_item-tc.dirsindir+1,
dircache[tc.selected_item].attr & attr & TREE_ATTR_MASK);
TREE_ATTR_MASK);
break; break;
case 2: /* files spelled */ case 2: /* files spelled */
talk_spell(dircache[tc.selected_item].name, talk_spell(name, false);
false);
break; break;
case 3: /* thumbnail clip */ case 3: /* thumbnail clip */
/* "schedule" a thumbnail, to have a little /* "schedule" a thumbnail, to have a little
delay */ delay */
if (dircache[tc.selected_item].attr & if (attr & TREE_ATTR_THUMBNAIL)
TREE_ATTR_THUMBNAIL)
thumbnail_time = current_tick + HOVER_DELAY; thumbnail_time = current_tick + HOVER_DELAY;
else else
/* spell the number as fallback */ /* spell the number as fallback */
talk_spell(dircache[tc.selected_item].name, talk_spell(name, false);
false);
break; break;
default: default: