summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2007-06-07 09:24:53 +0000
committerSteve Bavin <pondlife@pondlife.me>2007-06-07 09:24:53 +0000
commit6fd10bacceb576ee39e7ecfa32510ae8c97815ba (patch)
treed7a55ab832c6943fb469c34bd85d15e0fc7e2f2c /apps
parent44034055500509b3b2b85b6df66172abbf77399c (diff)
downloadrockbox-6fd10bacceb576ee39e7ecfa32510ae8c97815ba.tar.gz
rockbox-6fd10bacceb576ee39e7ecfa32510ae8c97815ba.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/lang/english.lang32
-rw-r--r--apps/menus/settings_menu.c20
-rw-r--r--apps/settings.h6
-rw-r--r--apps/settings_list.c14
-rw-r--r--apps/talk.c4
-rw-r--r--apps/tree.c59
6 files changed, 87 insertions, 48 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 19e369c93d..8f5291de82 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -2535,7 +2535,7 @@
2535</phrase> 2535</phrase>
2536<phrase> 2536<phrase>
2537 id: LANG_VOICE_DIR 2537 id: LANG_VOICE_DIR
2538 desc: item of voice menu, set the "talkbox" mode for directories 2538 desc: item of voice menu, set the voice mode for directories
2539 user: 2539 user:
2540 <source> 2540 <source>
2541 *: "Voice Directories" 2541 *: "Voice Directories"
@@ -2549,7 +2549,7 @@
2549</phrase> 2549</phrase>
2550<phrase> 2550<phrase>
2551 id: LANG_VOICE_FILE 2551 id: LANG_VOICE_FILE
2552 desc: item of voice menu, set the voive mode for files 2552 desc: item of voice menu, set the voice mode for files
2553 user: 2553 user:
2554 <source> 2554 <source>
2555 *: "Voice Filenames" 2555 *: "Voice Filenames"
@@ -10978,3 +10978,31 @@
10978 *: "List Acceleration Speed" 10978 *: "List Acceleration Speed"
10979 </voice> 10979 </voice>
10980</phrase> 10980</phrase>
10981<phrase>
10982 id: LANG_VOICE_DIR_TALK
10983 desc: Item of voice menu, whether to use directory .talk clips
10984 user:
10985 <source>
10986 *: "Use Directory .talk Clips"
10987 </source>
10988 <dest>
10989 *: "Use Directory .talk Clips"
10990 </dest>
10991 <voice>
10992 *: "Use Directory .talk Clips"
10993 </voice>
10994</phrase>
10995<phrase>
10996 id: LANG_VOICE_FILE_TALK
10997 desc: Item of voice menu, whether to use file .talk clips
10998 user:
10999 <source>
11000 *: "Use File .talk Clips"
11001 </source>
11002 <dest>
11003 *: "Use File .talk Clips"
11004 </dest>
11005 <voice>
11006 *: "Use File .talk Clips"
11007 </voice>
11008</phrase>
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 6d962824f1..a11a7f0c40 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -397,25 +397,28 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
397/***********************************/ 397/***********************************/
398/* VOICE MENU */ 398/* VOICE MENU */
399static int talk_callback(int action,const struct menu_item_ex *this_item); 399static int talk_callback(int action,const struct menu_item_ex *this_item);
400MENUITEM_SETTING(talk_menu, &global_settings.talk_menu, NULL); 400MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL);
401MENUITEM_SETTING(talk_dir, &global_settings.talk_dir, talk_callback); 401MENUITEM_SETTING(talk_dir_item, &global_settings.talk_dir, NULL);
402MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, talk_callback); 402MENUITEM_SETTING(talk_dir_clip_item, &global_settings.talk_dir_clip, talk_callback);
403MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, NULL);
404MENUITEM_SETTING(talk_file_clip_item, &global_settings.talk_file_clip, talk_callback);
403static int talk_callback(int action,const struct menu_item_ex *this_item) 405static int talk_callback(int action,const struct menu_item_ex *this_item)
404{ 406{
405 static int oldval = 0; 407 static int oldval = 0;
406 switch (action) 408 switch (action)
407 { 409 {
408 case ACTION_ENTER_MENUITEM: 410 case ACTION_ENTER_MENUITEM:
409 oldval = global_settings.talk_file; 411 oldval = global_settings.talk_file_clip;
410 break; 412 break;
411 case ACTION_EXIT_MENUITEM: 413 case ACTION_EXIT_MENUITEM:
412#if CONFIG_CODEC == SWCODEC 414#if CONFIG_CODEC == SWCODEC
413 audio_set_crossfade(global_settings.crossfade); 415 audio_set_crossfade(global_settings.crossfade);
414#endif 416#endif
415 if (this_item == &talk_dir) 417 if (this_item == &talk_dir_clip_item)
416 break; 418 break;
417 if (oldval != 3 && global_settings.talk_file == 3) 419 if (!oldval && global_settings.talk_file_clip)
418 { /* force reload if newly talking thumbnails, 420 {
421 /* force reload if newly talking thumbnails,
419 because the clip presence is cached only if enabled */ 422 because the clip presence is cached only if enabled */
420 reload_directory(); 423 reload_directory();
421 } 424 }
@@ -424,7 +427,8 @@ static int talk_callback(int action,const struct menu_item_ex *this_item)
424 return action; 427 return action;
425} 428}
426MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice, 429MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice,
427 &talk_menu, &talk_dir, &talk_file_item); 430 &talk_menu_item, &talk_dir_item, &talk_dir_clip_item,
431 &talk_file_item, &talk_file_clip_item);
428/* VOICE MENU */ 432/* VOICE MENU */
429/***********************************/ 433/***********************************/
430 434
diff --git a/apps/settings.h b/apps/settings.h
index b9c67dc8ea..4761ba4bfc 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -524,8 +524,10 @@ struct user_settings
524 524
525 /* voice UI settings */ 525 /* voice UI settings */
526 bool talk_menu; /* enable voice UI */ 526 bool talk_menu; /* enable voice UI */
527 int talk_dir; /* talkbox mode: 0=off 1=number 2=clip@enter 3=clip@hover */ 527 int talk_dir; /* voiced directories mode: 0=off 1=number 2=spell */
528 int talk_file; /* voice filename mode: 0=off, 1=number, other t.b.d. */ 528 bool talk_dir_clip; /* use directory .talk clips */
529 int talk_file; /* voice file mode: 0=off, 1=number, 2=spell */
530 bool talk_file_clip; /* use file .talk clips */
529 531
530 /* file browser sorting */ 532 /* file browser sorting */
531 int sort_file; /* 0=alpha, 1=date, 2=date (new first), 3=type */ 533 int sort_file; /* 0=alpha, 1=date, 2=date (new first), 3=type */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index f91cacf190..91c4cabe1b 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -50,7 +50,7 @@
50/* some sets of values which are used more than once, to save memory */ 50/* some sets of values which are used more than once, to save memory */
51static const char off_on[] = "off,on"; 51static const char off_on[] = "off,on";
52static const char off_on_ask[] = "off,on,ask"; 52static const char off_on_ask[] = "off,on,ask";
53static const char off_number_spell_hover[] = "off,number,spell,hover"; 53static const char off_number_spell[] = "off,number,spell";
54#ifdef HAVE_LCD_BITMAP 54#ifdef HAVE_LCD_BITMAP
55static const char graphic_numeric[] = "graphic,numeric"; 55static const char graphic_numeric[] = "graphic,numeric";
56#endif 56#endif
@@ -708,15 +708,17 @@ const struct settings_list settings[] = {
708 OFFON_SETTING(0,line_in,LANG_LINE_IN,false,"line in",NULL), 708 OFFON_SETTING(0,line_in,LANG_LINE_IN,false,"line in",NULL),
709#endif 709#endif
710 /* voice */ 710 /* voice */
711 OFFON_SETTING(F_TEMPVAR, talk_menu, LANG_VOICE_MENU, true, "talk menu", NULL),
711 CHOICE_SETTING(0, talk_dir, LANG_VOICE_DIR, 0, 712 CHOICE_SETTING(0, talk_dir, LANG_VOICE_DIR, 0,
712 "talk dir", off_number_spell_hover, NULL, 4, 713 "talk dir", off_number_spell, NULL, 3,
713 ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER), 714 ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER),
714 ID2P(LANG_VOICE_SPELL), ID2P(LANG_VOICE_DIR_HOVER)), 715 ID2P(LANG_VOICE_SPELL)),
716 OFFON_SETTING(F_TEMPVAR, talk_dir_clip, LANG_VOICE_DIR_TALK, false, "talk dir clip", NULL),
715 CHOICE_SETTING(0, talk_file, LANG_VOICE_FILE, 0, 717 CHOICE_SETTING(0, talk_file, LANG_VOICE_FILE, 0,
716 "talk file", off_number_spell_hover, NULL, 4, 718 "talk file", off_number_spell, NULL, 3,
717 ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER), 719 ID2P(LANG_OFF), ID2P(LANG_VOICE_NUMBER),
718 ID2P(LANG_VOICE_SPELL), ID2P(LANG_VOICE_DIR_HOVER)), 720 ID2P(LANG_VOICE_SPELL)),
719 OFFON_SETTING(F_TEMPVAR, talk_menu, LANG_VOICE_MENU, true, "talk menu", NULL), 721 OFFON_SETTING(F_TEMPVAR, talk_file_clip, LANG_VOICE_FILE_TALK, false, "talk file clip", NULL),
720 722
721 /* file sorting */ 723 /* file sorting */
722 CHOICE_SETTING(0, sort_file, LANG_SORT_FILE, 0 , 724 CHOICE_SETTING(0, sort_file, LANG_SORT_FILE, 0 ,
diff --git a/apps/talk.c b/apps/talk.c
index 04e37394b6..e9307f056f 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -539,8 +539,8 @@ void talk_init(void)
539bool talk_voice_required(void) 539bool talk_voice_required(void)
540{ 540{
541 return (voicefile_size != 0) /* Voice file is available */ 541 return (voicefile_size != 0) /* Voice file is available */
542 || (global_settings.talk_dir == 3) /* Thumbnail clips are required */ 542 || (global_settings.talk_dir_clip) /* Thumbnail clips are required */
543 || (global_settings.talk_file == 3); 543 || (global_settings.talk_file_clip);
544} 544}
545#endif 545#endif
546 546
diff --git a/apps/tree.c b/apps/tree.c
index 8875cb9c27..53aca47d49 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -722,9 +722,19 @@ static int dirbrowse()
722 DEBUGF("Playing directory thumbnail: %s", currdir); 722 DEBUGF("Playing directory thumbnail: %s", currdir);
723 res = ft_play_dirname(name); 723 res = ft_play_dirname(name);
724 if (res < 0) /* failed, not existing */ 724 if (res < 0) /* failed, not existing */
725 { /* say the number instead, as a fallback */ 725 {
726 talk_id(VOICE_DIR, false); 726 /* say the number or spell if required as a fallback */
727 talk_number(lasti+1, true); 727 switch (global_settings.talk_dir)
728 {
729 case 1: /* dirs as numbers */
730 talk_id(VOICE_DIR, false);
731 talk_number(lasti+1, true);
732 break;
733
734 case 2: /* dirs spelled */
735 talk_spell(name, false);
736 break;
737 }
728 } 738 }
729 } 739 }
730 else 740 else
@@ -847,8 +857,14 @@ static int dirbrowse()
847 /* Directory? */ 857 /* Directory? */
848 if (attr & ATTR_DIRECTORY) 858 if (attr & ATTR_DIRECTORY)
849 { 859 {
850 /* play directory thumbnail */ 860 /* schedule thumbnail playback if required */
851 switch (global_settings.talk_dir) { 861 if (global_settings.talk_dir_clip)
862 thumbnail_time = current_tick + HOVER_DELAY;
863 else
864 {
865 /* talk directly */
866 switch (global_settings.talk_dir)
867 {
852 case 1: /* dirs as numbers */ 868 case 1: /* dirs as numbers */
853 talk_id(VOICE_DIR, false); 869 talk_id(VOICE_DIR, false);
854 talk_number(tc.selected_item+1, true); 870 talk_number(tc.selected_item+1, true);
@@ -857,20 +873,19 @@ static int dirbrowse()
857 case 2: /* dirs spelled */ 873 case 2: /* dirs spelled */
858 talk_spell(name, false); 874 talk_spell(name, false);
859 break; 875 break;
860 876 }
861 case 3: /* thumbnail clip */
862 /* "schedule" a thumbnail, to have a little
863 delay */
864 thumbnail_time = current_tick + HOVER_DELAY;
865 break;
866
867 default:
868 break;
869 } 877 }
870 } 878 }
871 else /* file */ 879 else /* file */
872 { 880 {
873 switch (global_settings.talk_file) { 881 /* schedule thumbnail playback if required */
882 if (global_settings.talk_file_clip && (attr & FILE_ATTR_THUMBNAIL))
883 thumbnail_time = current_tick + HOVER_DELAY;
884 else
885 {
886 /* talk directly */
887 switch (global_settings.talk_file)
888 {
874 case 1: /* files as numbers */ 889 case 1: /* files as numbers */
875 ft_play_filenumber( 890 ft_play_filenumber(
876 tc.selected_item-tc.dirsindir+1, 891 tc.selected_item-tc.dirsindir+1,
@@ -880,19 +895,7 @@ static int dirbrowse()
880 case 2: /* files spelled */ 895 case 2: /* files spelled */
881 talk_spell(name, false); 896 talk_spell(name, false);
882 break; 897 break;
883 898 }
884 case 3: /* thumbnail clip */
885 /* "schedule" a thumbnail, to have a little
886 delay */
887 if (attr & FILE_ATTR_THUMBNAIL)
888 thumbnail_time = current_tick + HOVER_DELAY;
889 else
890 /* spell the number as fallback */
891 talk_spell(name, false);
892 break;
893
894 default:
895 break;
896 } 899 }
897 } 900 }
898 } 901 }