Separate out voice options for .talk clips (FS #7249). This removes the assumptions about what to speak if a .talk clip is not available for a particular file or directory,

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13584 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2007-06-07 09:24:53 +00:00
parent 4403405550
commit 6fd10bacce
6 changed files with 90 additions and 51 deletions

View file

@ -2535,7 +2535,7 @@
</phrase>
<phrase>
id: LANG_VOICE_DIR
desc: item of voice menu, set the "talkbox" mode for directories
desc: item of voice menu, set the voice mode for directories
user:
<source>
*: "Voice Directories"
@ -2549,7 +2549,7 @@
</phrase>
<phrase>
id: LANG_VOICE_FILE
desc: item of voice menu, set the voive mode for files
desc: item of voice menu, set the voice mode for files
user:
<source>
*: "Voice Filenames"
@ -10978,3 +10978,31 @@
*: "List Acceleration Speed"
</voice>
</phrase>
<phrase>
id: LANG_VOICE_DIR_TALK
desc: Item of voice menu, whether to use directory .talk clips
user:
<source>
*: "Use Directory .talk Clips"
</source>
<dest>
*: "Use Directory .talk Clips"
</dest>
<voice>
*: "Use Directory .talk Clips"
</voice>
</phrase>
<phrase>
id: LANG_VOICE_FILE_TALK
desc: Item of voice menu, whether to use file .talk clips
user:
<source>
*: "Use File .talk Clips"
</source>
<dest>
*: "Use File .talk Clips"
</dest>
<voice>
*: "Use File .talk Clips"
</voice>
</phrase>

View file

@ -397,25 +397,28 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
/***********************************/
/* VOICE MENU */
static int talk_callback(int action,const struct menu_item_ex *this_item);
MENUITEM_SETTING(talk_menu, &global_settings.talk_menu, NULL);
MENUITEM_SETTING(talk_dir, &global_settings.talk_dir, talk_callback);
MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, talk_callback);
MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL);
MENUITEM_SETTING(talk_dir_item, &global_settings.talk_dir, NULL);
MENUITEM_SETTING(talk_dir_clip_item, &global_settings.talk_dir_clip, talk_callback);
MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, NULL);
MENUITEM_SETTING(talk_file_clip_item, &global_settings.talk_file_clip, talk_callback);
static int talk_callback(int action,const struct menu_item_ex *this_item)
{
static int oldval = 0;
switch (action)
{
case ACTION_ENTER_MENUITEM:
oldval = global_settings.talk_file;
oldval = global_settings.talk_file_clip;
break;
case ACTION_EXIT_MENUITEM:
#if CONFIG_CODEC == SWCODEC
audio_set_crossfade(global_settings.crossfade);
#endif
if (this_item == &talk_dir)
if (this_item == &talk_dir_clip_item)
break;
if (oldval != 3 && global_settings.talk_file == 3)
{ /* force reload if newly talking thumbnails,
if (!oldval && global_settings.talk_file_clip)
{
/* force reload if newly talking thumbnails,
because the clip presence is cached only if enabled */
reload_directory();
}
@ -424,7 +427,8 @@ static int talk_callback(int action,const struct menu_item_ex *this_item)
return action;
}
MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice,
&talk_menu, &talk_dir, &talk_file_item);
&talk_menu_item, &talk_dir_item, &talk_dir_clip_item,
&talk_file_item, &talk_file_clip_item);
/* VOICE MENU */
/***********************************/

View file

@ -524,8 +524,10 @@ struct user_settings
/* voice UI settings */
bool talk_menu; /* enable voice UI */
int talk_dir; /* talkbox mode: 0=off 1=number 2=clip@enter 3=clip@hover */
int talk_file; /* voice filename mode: 0=off, 1=number, other t.b.d. */
int talk_dir; /* voiced directories mode: 0=off 1=number 2=spell */
bool talk_dir_clip; /* use directory .talk clips */
int talk_file; /* voice file mode: 0=off, 1=number, 2=spell */
bool talk_file_clip; /* use file .talk clips */
/* file browser sorting */
int sort_file; /* 0=alpha, 1=date, 2=date (new first), 3=type */

View file

@ -50,7 +50,7 @@
/* some sets of values which are used more than once, to save memory */
static const char off_on[] = "off,on";
static const char off_on_ask[] = "off,on,ask";
static const char off_number_spell_hover[] = "off,number,spell,hover";
static const char off_number_spell[] = "off,number,spell";
#ifdef HAVE_LCD_BITMAP
static const char graphic_numeric[] = "graphic,numeric";
#endif
@ -708,15 +708,17 @@ const struct settings_list settings[] = {
OFFON_SETTING(0,line_in,LANG_LINE_IN,false,"line in",NULL),
#endif
/* voice */
CHOICE_SETTING(0, talk_dir, LANG_VOICE_DIR, 0,
"talk dir", off_number_spell_hover, NULL, 4,
ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER),
ID2P(LANG_VOICE_SPELL), ID2P(LANG_VOICE_DIR_HOVER)),
CHOICE_SETTING(0, talk_file, LANG_VOICE_FILE, 0,
"talk file", off_number_spell_hover, NULL, 4,
ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER),
ID2P(LANG_VOICE_SPELL), ID2P(LANG_VOICE_DIR_HOVER)),
OFFON_SETTING(F_TEMPVAR, talk_menu, LANG_VOICE_MENU, true, "talk menu", NULL),
CHOICE_SETTING(0, talk_dir, LANG_VOICE_DIR, 0,
"talk dir", off_number_spell, NULL, 3,
ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER),
ID2P(LANG_VOICE_SPELL)),
OFFON_SETTING(F_TEMPVAR, talk_dir_clip, LANG_VOICE_DIR_TALK, false, "talk dir clip", NULL),
CHOICE_SETTING(0, talk_file, LANG_VOICE_FILE, 0,
"talk file", off_number_spell, NULL, 3,
ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER),
ID2P(LANG_VOICE_SPELL)),
OFFON_SETTING(F_TEMPVAR, talk_file_clip, LANG_VOICE_FILE_TALK, false, "talk file clip", NULL),
/* file sorting */
CHOICE_SETTING(0, sort_file, LANG_SORT_FILE, 0 ,

View file

@ -539,8 +539,8 @@ void talk_init(void)
bool talk_voice_required(void)
{
return (voicefile_size != 0) /* Voice file is available */
|| (global_settings.talk_dir == 3) /* Thumbnail clips are required */
|| (global_settings.talk_file == 3);
|| (global_settings.talk_dir_clip) /* Thumbnail clips are required */
|| (global_settings.talk_file_clip);
}
#endif

View file

@ -722,9 +722,19 @@ static int dirbrowse()
DEBUGF("Playing directory thumbnail: %s", currdir);
res = ft_play_dirname(name);
if (res < 0) /* failed, not existing */
{ /* say the number instead, as a fallback */
talk_id(VOICE_DIR, false);
talk_number(lasti+1, true);
{
/* say the number or spell if required as a fallback */
switch (global_settings.talk_dir)
{
case 1: /* dirs as numbers */
talk_id(VOICE_DIR, false);
talk_number(lasti+1, true);
break;
case 2: /* dirs spelled */
talk_spell(name, false);
break;
}
}
}
else
@ -847,8 +857,14 @@ static int dirbrowse()
/* Directory? */
if (attr & ATTR_DIRECTORY)
{
/* play directory thumbnail */
switch (global_settings.talk_dir) {
/* schedule thumbnail playback if required */
if (global_settings.talk_dir_clip)
thumbnail_time = current_tick + HOVER_DELAY;
else
{
/* talk directly */
switch (global_settings.talk_dir)
{
case 1: /* dirs as numbers */
talk_id(VOICE_DIR, false);
talk_number(tc.selected_item+1, true);
@ -857,20 +873,19 @@ static int dirbrowse()
case 2: /* dirs spelled */
talk_spell(name, false);
break;
case 3: /* thumbnail clip */
/* "schedule" a thumbnail, to have a little
delay */
thumbnail_time = current_tick + HOVER_DELAY;
break;
default:
break;
}
}
}
else /* file */
{
switch (global_settings.talk_file) {
/* schedule thumbnail playback if required */
if (global_settings.talk_file_clip && (attr & FILE_ATTR_THUMBNAIL))
thumbnail_time = current_tick + HOVER_DELAY;
else
{
/* talk directly */
switch (global_settings.talk_file)
{
case 1: /* files as numbers */
ft_play_filenumber(
tc.selected_item-tc.dirsindir+1,
@ -880,19 +895,7 @@ static int dirbrowse()
case 2: /* files spelled */
talk_spell(name, false);
break;
case 3: /* thumbnail clip */
/* "schedule" a thumbnail, to have a little
delay */
if (attr & FILE_ATTR_THUMBNAIL)
thumbnail_time = current_tick + HOVER_DELAY;
else
/* spell the number as fallback */
talk_spell(name, false);
break;
default:
break;
}
}
}
}