From d48442039ed399c0ba5ae51bc42d56b5b23f1bc4 Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Wed, 6 Oct 2004 21:37:46 +0000 Subject: patch #978765 by Carsten Tschach, new option for voice filenames: every file may have an optional .talk companion, with a filename clip. While at it, I removed the "on enter" directory talking, nobody used it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5194 a1c6a512-1295-4272-9138-f99709370657 --- apps/tree.c | 118 +++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 82 insertions(+), 36 deletions(-) (limited to 'apps/tree.c') diff --git a/apps/tree.c b/apps/tree.c index 90ae159418..effb093b41 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -221,6 +221,25 @@ static int build_playlist(int start_index) return start_index; } +static int play_filenumber(int pos, int attr) +{ + /* try to find a voice ID for the extension, if known */ + unsigned int j; + int ext_id = -1; /* default to none */ + for (j=0; jname); if (file->attr & ATTR_DIRECTORY) { - if (global_settings.talk_dir == 3) /* enter */ - { - /* play_dirname */ - DEBUGF("Playing directory thumbnail: %s", currdir); - play_dirname(dircursor+dirstart); - /* avoid reading getting cut by next filename */ - enqueue_next = true; - } memcpy(currdir,buf,sizeof(currdir)); if ( dirlevel < MAX_DIR_LEVELS ) { dirpos[dirlevel] = dirstart; @@ -1306,12 +1351,26 @@ static bool dirbrowse(const char *root, const int *dirfilter) TIME_AFTER(current_tick, thumbnail_time)) { /* a delayed hovering thumbnail is due now */ int res; - DEBUGF("Playing directory thumbnail: %s", currdir); - res = play_dirname(lasti); - if (res < 0) /* failed, not existing */ - { /* say the number instead, as a fallback */ - talk_id(VOICE_DIR, false); - talk_number(lasti+1, true); + if (dircache[lasti].attr & ATTR_DIRECTORY) + { + DEBUGF("Playing directory thumbnail: %s", currdir); + res = play_dirname(lasti); + if (res < 0) /* failed, not existing */ + { /* say the number instead, as a fallback */ + talk_id(VOICE_DIR, false); + talk_number(lasti+1, true); + } + } + else + { + DEBUGF("Playing file thumbnail: %s/%s%s\n", + currdir, dircache[lasti].name, TALK_EXT); + res = play_filename(currdir, dircache[lasti].name); + if (res < 0) /* failed, not existing */ + { /* say the number instead, as a fallback */ + play_filenumber(lasti-dirsindir+1, + dircache[lasti].attr); + } } thumbnail_time = -1; /* job done */ } @@ -1417,7 +1476,7 @@ static bool dirbrowse(const char *root, const int *dirfilter) if (dircache[i].attr & ATTR_DIRECTORY) /* directory? */ { /* play directory thumbnail */ - if (global_settings.talk_dir == 4) /* hover */ + if (global_settings.talk_dir == 3) /* hover */ { /* "schedule" a thumbnail, to have a little dalay */ thumbnail_time = current_tick + HOVER_DELAY; } @@ -1433,29 +1492,16 @@ static bool dirbrowse(const char *root, const int *dirfilter) } else if (global_settings.talk_file == 1) /* files as numbers */ { - /* try to find a voice ID for the extension, if known */ - unsigned int j; - int ext_id = -1; /* default to none */ - for (j=0; j