diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/bookmark.c | 2 | ||||
-rw-r--r-- | apps/menu.c | 2 | ||||
-rw-r--r-- | apps/menus/main_menu.c | 5 | ||||
-rw-r--r-- | apps/recorder/keyboard.c | 10 | ||||
-rw-r--r-- | apps/recorder/recording.c | 18 | ||||
-rw-r--r-- | apps/screens.c | 4 | ||||
-rw-r--r-- | apps/settings.c | 11 | ||||
-rw-r--r-- | apps/talk.c | 18 | ||||
-rw-r--r-- | apps/talk.h | 4 |
9 files changed, 48 insertions, 26 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c index e8b3b6e52d..f36545fe39 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -671,7 +671,7 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu | |||
671 | item--; | 671 | item--; |
672 | } | 672 | } |
673 | 673 | ||
674 | if (item != last_item && global_settings.talk_menu) | 674 | if (item != last_item && talk_menus_enabled()) |
675 | { | 675 | { |
676 | last_item = item; | 676 | last_item = item; |
677 | 677 | ||
diff --git a/apps/menu.c b/apps/menu.c index a29f5d5dde..8f0d1318ef 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -224,7 +224,7 @@ static void talk_menu_item(const struct menu_item_ex *menu, | |||
224 | unsigned char *str; | 224 | unsigned char *str; |
225 | int sel; | 225 | int sel; |
226 | 226 | ||
227 | if (global_settings.talk_menu) | 227 | if (talk_menus_enabled()) |
228 | { | 228 | { |
229 | sel = get_menu_selection(gui_synclist_get_sel_pos(lists),menu); | 229 | sel = get_menu_selection(gui_synclist_get_sel_pos(lists),menu); |
230 | if ((menu->flags&MENU_TYPE_MASK) == MT_MENU) | 230 | if ((menu->flags&MENU_TYPE_MASK) == MT_MENU) |
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index ecc3d86ad9..061c5c215e 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c | |||
@@ -177,8 +177,9 @@ static bool show_info(void) | |||
177 | size2 = 0; | 177 | size2 = 0; |
178 | #endif | 178 | #endif |
179 | 179 | ||
180 | if (global_settings.talk_menu) | 180 | if (talk_menus_enabled()) |
181 | { /* say whatever is reasonable, no real connection to the screen */ | 181 | { |
182 | /* say whatever is reasonable, no real connection to the screen */ | ||
182 | bool enqueue = false; /* enqueue all but the first */ | 183 | bool enqueue = false; /* enqueue all but the first */ |
183 | if (battery_level() >= 0) | 184 | if (battery_level() >= 0) |
184 | { | 185 | { |
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 5c97f2bad6..3ce0208b7e 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c | |||
@@ -190,7 +190,7 @@ static void kbd_spellchar(unsigned short c) | |||
190 | { | 190 | { |
191 | static char spell_char[2] = "\0\0"; /* store char to pass to talk_spell */ | 191 | static char spell_char[2] = "\0\0"; /* store char to pass to talk_spell */ |
192 | 192 | ||
193 | if (global_settings.talk_menu && c < 128) /* voice UI? */ | 193 | if (talk_menus_enabled() && c < 128) /* voice UI? */ |
194 | { | 194 | { |
195 | spell_char[0] = (char)c; | 195 | spell_char[0] = (char)c; |
196 | talk_spell(spell_char, false); | 196 | talk_spell(spell_char, false); |
@@ -510,7 +510,7 @@ int kbd_input(char* text, int buflen) | |||
510 | /* Initial edit position is after last character */ | 510 | /* Initial edit position is after last character */ |
511 | editpos = utf8length(text); | 511 | editpos = utf8length(text); |
512 | 512 | ||
513 | if (global_settings.talk_menu) /* voice UI? */ | 513 | if (talk_menus_enabled()) /* voice UI? */ |
514 | talk_spell(text, true); /* spell initial text */ | 514 | talk_spell(text, true); /* spell initial text */ |
515 | 515 | ||
516 | action_signalscreenchange(); | 516 | action_signalscreenchange(); |
@@ -1087,7 +1087,7 @@ int kbd_input(char* text, int buflen) | |||
1087 | kbd_inschar(text, buflen, &editpos, ch); | 1087 | kbd_inschar(text, buflen, &editpos, ch); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | if (global_settings.talk_menu) /* voice UI? */ | 1090 | if (talk_menus_enabled()) /* voice UI? */ |
1091 | talk_spell(text, false); | 1091 | talk_spell(text, false); |
1092 | 1092 | ||
1093 | /* speak revised text */ | 1093 | /* speak revised text */ |
@@ -1116,7 +1116,7 @@ int kbd_input(char* text, int buflen) | |||
1116 | kbd_inschar(text, buflen, &editpos, ch); | 1116 | kbd_inschar(text, buflen, &editpos, ch); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | if (global_settings.talk_menu) /* voice UI? */ | 1119 | if (talk_menus_enabled()) /* voice UI? */ |
1120 | talk_spell(text, false); /* speak revised text */ | 1120 | talk_spell(text, false); /* speak revised text */ |
1121 | break; | 1121 | break; |
1122 | 1122 | ||
@@ -1167,7 +1167,7 @@ int kbd_input(char* text, int buflen) | |||
1167 | param[l].hangul = false; | 1167 | param[l].hangul = false; |
1168 | kbd_inschar(text, buflen, &editpos, morse_alphabets[j]); | 1168 | kbd_inschar(text, buflen, &editpos, morse_alphabets[j]); |
1169 | 1169 | ||
1170 | if (global_settings.talk_menu) /* voice UI? */ | 1170 | if (talk_menus_enabled()) /* voice UI? */ |
1171 | talk_spell(text, false); /* speak revised text */ | 1171 | talk_spell(text, false); /* speak revised text */ |
1172 | } | 1172 | } |
1173 | #endif /* KBD_MORSE_INPUT */ | 1173 | #endif /* KBD_MORSE_INPUT */ |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 226ff9a17f..f7ceb508d5 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -705,7 +705,6 @@ bool recording_screen(bool no_source) | |||
705 | int radio_status = (global_settings.rec_source != AUDIO_SRC_FMRADIO) ? | 705 | int radio_status = (global_settings.rec_source != AUDIO_SRC_FMRADIO) ? |
706 | FMRADIO_OFF : get_radio_status(); | 706 | FMRADIO_OFF : get_radio_status(); |
707 | #endif | 707 | #endif |
708 | int talk_menu = global_settings.talk_menu; | ||
709 | #if (CONFIG_LED == LED_REAL) | 708 | #if (CONFIG_LED == LED_REAL) |
710 | bool led_state = false; | 709 | bool led_state = false; |
711 | int led_countdown = 2; | 710 | int led_countdown = 2; |
@@ -741,9 +740,8 @@ bool recording_screen(bool no_source) | |||
741 | #endif | 740 | #endif |
742 | 741 | ||
743 | #if CONFIG_CODEC == SWCODEC | 742 | #if CONFIG_CODEC == SWCODEC |
744 | /* recording_menu gets messed up: so reset talk_menu */ | 743 | /* recording_menu gets messed up: so prevent manus talking */ |
745 | talk_menu = global_settings.talk_menu; | 744 | talk_disable_menus(); |
746 | global_settings.talk_menu = 0; | ||
747 | /* audio_init_recording stops anything playing when it takes the audio | 745 | /* audio_init_recording stops anything playing when it takes the audio |
748 | buffer */ | 746 | buffer */ |
749 | #else | 747 | #else |
@@ -931,8 +929,9 @@ bool recording_screen(bool no_source) | |||
931 | have_recorded = true; | 929 | have_recorded = true; |
932 | rec_record(); | 930 | rec_record(); |
933 | last_seconds = 0; | 931 | last_seconds = 0; |
934 | if (talk_menu) | 932 | if (global_settings.talk_menu) |
935 | { /* no voice possible here, but a beep */ | 933 | { |
934 | /* no voice possible here, but a beep */ | ||
936 | audio_beep(HZ/2); /* longer beep on start */ | 935 | audio_beep(HZ/2); /* longer beep on start */ |
937 | } | 936 | } |
938 | } | 937 | } |
@@ -960,8 +959,9 @@ bool recording_screen(bool no_source) | |||
960 | if(audio_stat & AUDIO_STATUS_PAUSE) | 959 | if(audio_stat & AUDIO_STATUS_PAUSE) |
961 | { | 960 | { |
962 | audio_resume_recording(); | 961 | audio_resume_recording(); |
963 | if (talk_menu) | 962 | if (global_settings.talk_menu) |
964 | { /* no voice possible here, but a beep */ | 963 | { |
964 | /* no voice possible here, but a beep */ | ||
965 | audio_beep(HZ/4); /* short beep on resume */ | 965 | audio_beep(HZ/4); /* short beep on resume */ |
966 | } | 966 | } |
967 | } | 967 | } |
@@ -1695,7 +1695,7 @@ bool recording_screen(bool no_source) | |||
1695 | rec_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); | 1695 | rec_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); |
1696 | 1696 | ||
1697 | /* restore talk_menu setting */ | 1697 | /* restore talk_menu setting */ |
1698 | global_settings.talk_menu = talk_menu; | 1698 | talk_enable_menus(); |
1699 | #else /* !SWCODEC */ | 1699 | #else /* !SWCODEC */ |
1700 | audio_init_playback(); | 1700 | audio_init_playback(); |
1701 | #endif /* CONFIG_CODEC == SWCODEC */ | 1701 | #endif /* CONFIG_CODEC == SWCODEC */ |
diff --git a/apps/screens.c b/apps/screens.c index e6f0a28c0a..d8e3121121 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -155,7 +155,7 @@ int mmc_remove_request(void) | |||
155 | FOR_NB_SCREENS(i) | 155 | FOR_NB_SCREENS(i) |
156 | screens[i].clear_display(); | 156 | screens[i].clear_display(); |
157 | gui_syncsplash(1, str(LANG_REMOVE_MMC)); | 157 | gui_syncsplash(1, str(LANG_REMOVE_MMC)); |
158 | if (global_settings.talk_menu) | 158 | if (talk_menus_enabled()) |
159 | talk_id(LANG_REMOVE_MMC, false); | 159 | talk_id(LANG_REMOVE_MMC, false); |
160 | 160 | ||
161 | while (1) | 161 | while (1) |
@@ -821,7 +821,7 @@ static void say_time(int cursorpos, const struct tm *tm) | |||
821 | static const int unit[] = { UNIT_HOUR, UNIT_MIN, UNIT_SEC, 0, 0, 0 }; | 821 | static const int unit[] = { UNIT_HOUR, UNIT_MIN, UNIT_SEC, 0, 0, 0 }; |
822 | int value = 0; | 822 | int value = 0; |
823 | 823 | ||
824 | if (!global_settings.talk_menu) | 824 | if (!talk_menus_enabled()) |
825 | return; | 825 | return; |
826 | 826 | ||
827 | switch(cursorpos) | 827 | switch(cursorpos) |
diff --git a/apps/settings.c b/apps/settings.c index 2bae9ae1b1..09c90af066 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -952,7 +952,7 @@ const struct settings_list* find_setting(void* variable, int *id) | |||
952 | void talk_setting(void *global_settings_variable) | 952 | void talk_setting(void *global_settings_variable) |
953 | { | 953 | { |
954 | const struct settings_list *setting; | 954 | const struct settings_list *setting; |
955 | if (global_settings.talk_menu == 0) | 955 | if (!talk_menus_enabled()) |
956 | return; | 956 | return; |
957 | setting = find_setting(global_settings_variable, NULL); | 957 | setting = find_setting(global_settings_variable, NULL); |
958 | if (setting == NULL) | 958 | if (setting == NULL) |
@@ -1043,7 +1043,7 @@ bool set_bool_options(const char* string, bool* variable, | |||
1043 | 1043 | ||
1044 | static void talk_unit(int unit, int value, long (*get_talk_id)(int value)) | 1044 | static void talk_unit(int unit, int value, long (*get_talk_id)(int value)) |
1045 | { | 1045 | { |
1046 | if (global_settings.talk_menu) | 1046 | if (talk_menus_enabled()) |
1047 | { | 1047 | { |
1048 | if (get_talk_id) | 1048 | if (get_talk_id) |
1049 | { | 1049 | { |
@@ -1121,11 +1121,12 @@ static bool do_set_setting(const unsigned char* string, void *variable, | |||
1121 | gui_synclist_limit_scroll(&lists,true); | 1121 | gui_synclist_limit_scroll(&lists,true); |
1122 | gui_synclist_select_item(&lists, selected); | 1122 | gui_synclist_select_item(&lists, selected); |
1123 | 1123 | ||
1124 | if (global_settings.talk_menu) | 1124 | if (talk_menus_enabled()) |
1125 | { | 1125 | { |
1126 | if (cb_data->type == INT && !cb_data->options) | 1126 | if (cb_data->type == INT && !cb_data->options) |
1127 | talk_unit(cb_data->voice_unit, *(int*)variable, cb_data->get_talk_id); | 1127 | talk_unit(cb_data->voice_unit, *(int*)variable, cb_data->get_talk_id); |
1128 | else talk_id(cb_data->options[selected].voice_id, false); | 1128 | else |
1129 | talk_id(cb_data->options[selected].voice_id, false); | ||
1129 | } | 1130 | } |
1130 | 1131 | ||
1131 | gui_synclist_draw(&lists); | 1132 | gui_synclist_draw(&lists); |
@@ -1139,7 +1140,7 @@ static bool do_set_setting(const unsigned char* string, void *variable, | |||
1139 | if (gui_synclist_do_button(&lists,action, | 1140 | if (gui_synclist_do_button(&lists,action, |
1140 | allow_wrap?LIST_WRAP_UNLESS_HELD:LIST_WRAP_OFF)) | 1141 | allow_wrap?LIST_WRAP_UNLESS_HELD:LIST_WRAP_OFF)) |
1141 | { | 1142 | { |
1142 | if (global_settings.talk_menu) | 1143 | if (talk_menus_enabled()) |
1143 | { | 1144 | { |
1144 | int value; | 1145 | int value; |
1145 | if (cb_data->type == INT && !cb_data->options) | 1146 | if (cb_data->type == INT && !cb_data->options) |
diff --git a/apps/talk.c b/apps/talk.c index e9307f056f..1f1eefd51d 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -127,6 +127,7 @@ static unsigned char* p_lastclip; /* address of latest clip, for silence add */ | |||
127 | static unsigned long voicefile_size = 0; /* size of the loaded voice file */ | 127 | static unsigned long voicefile_size = 0; /* size of the loaded voice file */ |
128 | static unsigned char last_lang[MAX_FILENAME+1]; /* name of last used lang file (in talk_init) */ | 128 | static unsigned char last_lang[MAX_FILENAME+1]; /* name of last used lang file (in talk_init) */ |
129 | static bool talk_initialized; /* true if talk_init has been called */ | 129 | static bool talk_initialized; /* true if talk_init has been called */ |
130 | static int talk_menu_disable; /* if non-zero, temporarily disable voice UI (not saved) */ | ||
130 | 131 | ||
131 | /***************** Private prototypes *****************/ | 132 | /***************** Private prototypes *****************/ |
132 | 133 | ||
@@ -498,6 +499,7 @@ static void reset_state(void) | |||
498 | 499 | ||
499 | void talk_init(void) | 500 | void talk_init(void) |
500 | { | 501 | { |
502 | talk_menu_disable = 0; | ||
501 | if (talk_initialized && !strcasecmp(last_lang, global_settings.lang_file)) | 503 | if (talk_initialized && !strcasecmp(last_lang, global_settings.lang_file)) |
502 | { | 504 | { |
503 | /* not a new file, nothing to do */ | 505 | /* not a new file, nothing to do */ |
@@ -819,3 +821,19 @@ int talk_spell(const char* spell, bool enqueue) | |||
819 | 821 | ||
820 | return 0; | 822 | return 0; |
821 | } | 823 | } |
824 | |||
825 | bool talk_menus_enabled(void) | ||
826 | { | ||
827 | return (global_settings.talk_menu && talk_menu_disable == 0); | ||
828 | } | ||
829 | |||
830 | |||
831 | void talk_disable_menus(void) | ||
832 | { | ||
833 | talk_menu_disable++; | ||
834 | } | ||
835 | |||
836 | void talk_enable_menus(void) | ||
837 | { | ||
838 | talk_menu_disable--; | ||
839 | } | ||
diff --git a/apps/talk.h b/apps/talk.h index 10e49eb301..6c9bc089f8 100644 --- a/apps/talk.h +++ b/apps/talk.h | |||
@@ -71,5 +71,7 @@ int talk_file(const char* filename, bool enqueue); /* play a thumbnail from file | |||
71 | int talk_number(long n, bool enqueue); /* say a number */ | 71 | int talk_number(long n, bool enqueue); /* say a number */ |
72 | int talk_value(long n, int unit, bool enqueue); /* say a numeric value */ | 72 | int talk_value(long n, int unit, bool enqueue); /* say a numeric value */ |
73 | int talk_spell(const char* spell, bool enqueue); /* spell a string */ | 73 | int talk_spell(const char* spell, bool enqueue); /* spell a string */ |
74 | 74 | bool talk_menus_enabled(void); /* returns true if menus should be voiced */ | |
75 | void talk_disable_menus(void); | ||
76 | void talk_enable_menus(void); | ||
75 | #endif /* __TALK_H__ */ | 77 | #endif /* __TALK_H__ */ |