forked from len0rd/rockbox
When recording, disable voice menus without actually modifying user settings. Patch FS#7272, fixes bug FS #6163
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13615 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0fba85fe9e
commit
24d9f59c78
9 changed files with 48 additions and 26 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
18
apps/talk.c
18
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--;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue