summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c64
1 files changed, 44 insertions, 20 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 8bd21bb6a4..01aabf7d82 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -70,32 +70,33 @@ static struct
70 char* extension; /* extension for which the file type is recognized */ 70 char* extension; /* extension for which the file type is recognized */
71 int tree_attr; /* which identifier */ 71 int tree_attr; /* which identifier */
72 int icon; /* the icon which shall be used for it, -1 if unknown */ 72 int icon; /* the icon which shall be used for it, -1 if unknown */
73 int voiceclip; /* spoken extension */
73 /* To have it extendable, there could be more useful stuff in here, 74 /* To have it extendable, there could be more useful stuff in here,
74 like handler functions, plugin name, etc. */ 75 like handler functions, plugin name, etc. */
75} filetypes[] = { 76} filetypes[] = {
76 { ".mp3", TREE_ATTR_MPA, File }, 77 { ".mp3", TREE_ATTR_MPA, File, VOICE_EXT_MPA },
77 { ".mp2", TREE_ATTR_MPA, File }, 78 { ".mp2", TREE_ATTR_MPA, File, VOICE_EXT_MPA },
78 { ".mpa", TREE_ATTR_MPA, File }, 79 { ".mpa", TREE_ATTR_MPA, File, VOICE_EXT_MPA },
79 { ".m3u", TREE_ATTR_M3U, Playlist }, 80 { ".m3u", TREE_ATTR_M3U, Playlist, LANG_PLAYINDICES_PLAYLIST },
80 { ".cfg", TREE_ATTR_CFG, Config }, 81 { ".cfg", TREE_ATTR_CFG, Config, VOICE_EXT_CFG },
81 { ".wps", TREE_ATTR_WPS, Wps, }, 82 { ".wps", TREE_ATTR_WPS, Wps, VOICE_EXT_WPS },
82 { ".txt", TREE_ATTR_TXT, Text }, 83 { ".txt", TREE_ATTR_TXT, Text, VOICE_EXT_TXT },
83 { ".lng", TREE_ATTR_LNG, Language }, 84 { ".lng", TREE_ATTR_LNG, Language, LANG_LANGUAGE },
84 { ".rock",TREE_ATTR_ROCK,Plugin }, 85 { ".rock",TREE_ATTR_ROCK,Plugin, VOICE_EXT_ROCK },
85#ifdef HAVE_LCD_BITMAP 86#ifdef HAVE_LCD_BITMAP
86 { ".fnt", TREE_ATTR_FONT,Font }, 87 { ".fnt", TREE_ATTR_FONT,Font, VOICE_EXT_FONT },
87 { ".ch8", TREE_ATTR_CH8, Chip8 }, 88 { ".ch8", TREE_ATTR_CH8, Chip8, -1 },
88 { ".rvf", TREE_ATTR_RVF, Video }, 89 { ".rvf", TREE_ATTR_RVF, Video, -1 },
89 { ".bmark",TREE_ATTR_BMARK,Bookmark }, 90 { ".bmark",TREE_ATTR_BMARK, Bookmark, VOICE_EXT_BMARK },
90#else 91#else
91 { ".bmark", TREE_ATTR_BMARK, -1 }, 92 { ".bmark", TREE_ATTR_BMARK, -1, VOICE_EXT_BMARK },
92#endif 93#endif
93#ifndef SIMULATOR 94#ifndef SIMULATOR
94#ifdef HAVE_LCD_BITMAP 95#ifdef HAVE_LCD_BITMAP
95 { ".ucl", TREE_ATTR_UCL, Flashfile}, 96 { ".ucl", TREE_ATTR_UCL, Flashfile, VOICE_EXT_UCL },
96 { ".ajz", TREE_ATTR_MOD, Mod_Ajz }, 97 { ".ajz", TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ },
97#else 98#else
98 { ".mod", TREE_ATTR_MOD, Mod_Ajz }, 99 { ".mod", TREE_ATTR_MOD, Mod_Ajz, VOICE_EXT_AJZ },
99#endif 100#endif
100#endif /* #ifndef SIMULATOR */ 101#endif /* #ifndef SIMULATOR */
101}; 102};
@@ -195,7 +196,7 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6];
195#endif /* HAVE_RECORDER_KEYPAD */ 196#endif /* HAVE_RECORDER_KEYPAD */
196 197
197/* talkbox hovering delay, to avoid immediate disk activity */ 198/* talkbox hovering delay, to avoid immediate disk activity */
198#define HOVER_DELAY (HZ) 199#define HOVER_DELAY (HZ/2)
199 200
200static int build_playlist(int start_index) 201static int build_playlist(int start_index)
201{ 202{
@@ -1061,7 +1062,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1061 snprintf(buf,sizeof(buf),"/%s",file->name); 1062 snprintf(buf,sizeof(buf),"/%s",file->name);
1062 1063
1063 if (file->attr & ATTR_DIRECTORY) { 1064 if (file->attr & ATTR_DIRECTORY) {
1064 if (global_settings.talk_dir == 2) /* enter */ 1065 if (global_settings.talk_dir == 3) /* enter */
1065 { 1066 {
1066 /* play_dirname */ 1067 /* play_dirname */
1067 DEBUGF("Playing directory thumbnail: %s", currdir); 1068 DEBUGF("Playing directory thumbnail: %s", currdir);
@@ -1493,7 +1494,7 @@ static bool dirbrowse(char *root, int *dirfilter)
1493 if (dircache[i].attr & ATTR_DIRECTORY) /* directory? */ 1494 if (dircache[i].attr & ATTR_DIRECTORY) /* directory? */
1494 { 1495 {
1495 /* play directory thumbnail */ 1496 /* play directory thumbnail */
1496 if (global_settings.talk_dir == 3) /* hover */ 1497 if (global_settings.talk_dir == 4) /* hover */
1497 { /* "schedule" a thumbnail, to have a little dalay */ 1498 { /* "schedule" a thumbnail, to have a little dalay */
1498 thumbnail_time = current_tick + HOVER_DELAY; 1499 thumbnail_time = current_tick + HOVER_DELAY;
1499 } 1500 }
@@ -1502,12 +1503,35 @@ static bool dirbrowse(char *root, int *dirfilter)
1502 talk_id(VOICE_DIR, false); 1503 talk_id(VOICE_DIR, false);
1503 talk_number(i+1, true); 1504 talk_number(i+1, true);
1504 } 1505 }
1506 else if (global_settings.talk_dir == 2) /* dirs spelled */
1507 {
1508 talk_spell(dircache[i].name, false);
1509 }
1505 } 1510 }
1506 else if (global_settings.talk_file == 1) /* files as numbers */ 1511 else if (global_settings.talk_file == 1) /* files as numbers */
1507 { 1512 {
1513 /* try to find a voice ID for the extension, if known */
1514 int j;
1515 int ext_id = -1; /* default to none */
1516 for (j=0; j<sizeof(filetypes)/sizeof(*filetypes); j++)
1517 {
1518 if ((dircache[i].attr & TREE_ATTR_MASK) == filetypes[j].tree_attr)
1519 {
1520 ext_id = filetypes[j].voiceclip;
1521 break;
1522 }
1523 }
1524
1508 /* enqueue_next is true if still talking the dir name */ 1525 /* enqueue_next is true if still talking the dir name */
1509 talk_id(VOICE_FILE, enqueue_next); 1526 talk_id(VOICE_FILE, enqueue_next);
1510 talk_number(i-dirsindir+1, true); 1527 talk_number(i-dirsindir+1, true);
1528 talk_id(ext_id, true);
1529 enqueue_next = false;
1530 }
1531 else if (global_settings.talk_file == 2) /* files spelled */
1532 {
1533 /* enqueue_next is true if still talking the dir name */
1534 talk_spell(dircache[i].name, enqueue_next);
1511 enqueue_next = false; 1535 enqueue_next = false;
1512 } 1536 }
1513 1537