summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/bookmark.c2
-rw-r--r--apps/menu.c2
-rw-r--r--apps/menus/main_menu.c5
-rw-r--r--apps/recorder/keyboard.c10
-rw-r--r--apps/recorder/recording.c18
-rw-r--r--apps/screens.c4
-rw-r--r--apps/settings.c11
-rw-r--r--apps/talk.c18
-rw-r--r--apps/talk.h4
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
item--;
}
- if (item != last_item && global_settings.talk_menu)
+ if (item != last_item && talk_menus_enabled())
{
last_item = item;
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,
unsigned char *str;
int sel;
- if (global_settings.talk_menu)
+ if (talk_menus_enabled())
{
sel = get_menu_selection(gui_synclist_get_sel_pos(lists),menu);
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)
size2 = 0;
#endif
- if (global_settings.talk_menu)
- { /* say whatever is reasonable, no real connection to the screen */
+ if (talk_menus_enabled())
+ {
+ /* say whatever is reasonable, no real connection to the screen */
bool enqueue = false; /* enqueue all but the first */
if (battery_level() >= 0)
{
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)
{
static char spell_char[2] = "\0\0"; /* store char to pass to talk_spell */
- if (global_settings.talk_menu && c < 128) /* voice UI? */
+ if (talk_menus_enabled() && c < 128) /* voice UI? */
{
spell_char[0] = (char)c;
talk_spell(spell_char, false);
@@ -510,7 +510,7 @@ int kbd_input(char* text, int buflen)
/* Initial edit position is after last character */
editpos = utf8length(text);
- if (global_settings.talk_menu) /* voice UI? */
+ if (talk_menus_enabled()) /* voice UI? */
talk_spell(text, true); /* spell initial text */
action_signalscreenchange();
@@ -1087,7 +1087,7 @@ int kbd_input(char* text, int buflen)
kbd_inschar(text, buflen, &editpos, ch);
}
- if (global_settings.talk_menu) /* voice UI? */
+ if (talk_menus_enabled()) /* voice UI? */
talk_spell(text, false);
/* speak revised text */
@@ -1116,7 +1116,7 @@ int kbd_input(char* text, int buflen)
kbd_inschar(text, buflen, &editpos, ch);
}
- if (global_settings.talk_menu) /* voice UI? */
+ if (talk_menus_enabled()) /* voice UI? */
talk_spell(text, false); /* speak revised text */
break;
@@ -1167,7 +1167,7 @@ int kbd_input(char* text, int buflen)
param[l].hangul = false;
kbd_inschar(text, buflen, &editpos, morse_alphabets[j]);
- if (global_settings.talk_menu) /* voice UI? */
+ if (talk_menus_enabled()) /* voice UI? */
talk_spell(text, false); /* speak revised text */
}
#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)
int radio_status = (global_settings.rec_source != AUDIO_SRC_FMRADIO) ?
FMRADIO_OFF : get_radio_status();
#endif
- int talk_menu = global_settings.talk_menu;
#if (CONFIG_LED == LED_REAL)
bool led_state = false;
int led_countdown = 2;
@@ -741,9 +740,8 @@ bool recording_screen(bool no_source)
#endif
#if CONFIG_CODEC == SWCODEC
- /* recording_menu gets messed up: so reset talk_menu */
- talk_menu = global_settings.talk_menu;
- global_settings.talk_menu = 0;
+ /* recording_menu gets messed up: so prevent manus talking */
+ talk_disable_menus();
/* audio_init_recording stops anything playing when it takes the audio
buffer */
#else
@@ -931,8 +929,9 @@ bool recording_screen(bool no_source)
have_recorded = true;
rec_record();
last_seconds = 0;
- if (talk_menu)
- { /* no voice possible here, but a beep */
+ if (global_settings.talk_menu)
+ {
+ /* no voice possible here, but a beep */
audio_beep(HZ/2); /* longer beep on start */
}
}
@@ -960,8 +959,9 @@ bool recording_screen(bool no_source)
if(audio_stat & AUDIO_STATUS_PAUSE)
{
audio_resume_recording();
- if (talk_menu)
- { /* no voice possible here, but a beep */
+ if (global_settings.talk_menu)
+ {
+ /* no voice possible here, but a beep */
audio_beep(HZ/4); /* short beep on resume */
}
}
@@ -1695,7 +1695,7 @@ bool recording_screen(bool no_source)
rec_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
/* restore talk_menu setting */
- global_settings.talk_menu = talk_menu;
+ talk_enable_menus();
#else /* !SWCODEC */
audio_init_playback();
#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)
FOR_NB_SCREENS(i)
screens[i].clear_display();
gui_syncsplash(1, str(LANG_REMOVE_MMC));
- if (global_settings.talk_menu)
+ if (talk_menus_enabled())
talk_id(LANG_REMOVE_MMC, false);
while (1)
@@ -821,7 +821,7 @@ static void say_time(int cursorpos, const struct tm *tm)
static const int unit[] = { UNIT_HOUR, UNIT_MIN, UNIT_SEC, 0, 0, 0 };
int value = 0;
- if (!global_settings.talk_menu)
+ if (!talk_menus_enabled())
return;
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)
void talk_setting(void *global_settings_variable)
{
const struct settings_list *setting;
- if (global_settings.talk_menu == 0)
+ if (!talk_menus_enabled())
return;
setting = find_setting(global_settings_variable, NULL);
if (setting == NULL)
@@ -1043,7 +1043,7 @@ bool set_bool_options(const char* string, bool* variable,
static void talk_unit(int unit, int value, long (*get_talk_id)(int value))
{
- if (global_settings.talk_menu)
+ if (talk_menus_enabled())
{
if (get_talk_id)
{
@@ -1121,11 +1121,12 @@ static bool do_set_setting(const unsigned char* string, void *variable,
gui_synclist_limit_scroll(&lists,true);
gui_synclist_select_item(&lists, selected);
- if (global_settings.talk_menu)
+ if (talk_menus_enabled())
{
if (cb_data->type == INT && !cb_data->options)
talk_unit(cb_data->voice_unit, *(int*)variable, cb_data->get_talk_id);
- else talk_id(cb_data->options[selected].voice_id, false);
+ else
+ talk_id(cb_data->options[selected].voice_id, false);
}
gui_synclist_draw(&lists);
@@ -1139,7 +1140,7 @@ static bool do_set_setting(const unsigned char* string, void *variable,
if (gui_synclist_do_button(&lists,action,
allow_wrap?LIST_WRAP_UNLESS_HELD:LIST_WRAP_OFF))
{
- if (global_settings.talk_menu)
+ if (talk_menus_enabled())
{
int value;
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 */
static unsigned long voicefile_size = 0; /* size of the loaded voice file */
static unsigned char last_lang[MAX_FILENAME+1]; /* name of last used lang file (in talk_init) */
static bool talk_initialized; /* true if talk_init has been called */
+static int talk_menu_disable; /* if non-zero, temporarily disable voice UI (not saved) */
/***************** Private prototypes *****************/
@@ -498,6 +499,7 @@ static void reset_state(void)
void talk_init(void)
{
+ talk_menu_disable = 0;
if (talk_initialized && !strcasecmp(last_lang, global_settings.lang_file))
{
/* not a new file, nothing to do */
@@ -819,3 +821,19 @@ int talk_spell(const char* spell, bool enqueue)
return 0;
}
+
+bool talk_menus_enabled(void)
+{
+ return (global_settings.talk_menu && talk_menu_disable == 0);
+}
+
+
+void talk_disable_menus(void)
+{
+ talk_menu_disable++;
+}
+
+void talk_enable_menus(void)
+{
+ talk_menu_disable--;
+}
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
int talk_number(long n, bool enqueue); /* say a number */
int talk_value(long n, int unit, bool enqueue); /* say a numeric value */
int talk_spell(const char* spell, bool enqueue); /* spell a string */
-
+bool talk_menus_enabled(void); /* returns true if menus should be voiced */
+void talk_disable_menus(void);
+void talk_enable_menus(void);
#endif /* __TALK_H__ */