mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
talk: Keep UI responsive when spelling out long strings
Commit 3b1230b
ensured that strings exceeding QUEUE_SIZE
were spelled out completely, but also resulted in the UI
becoming unresponsive.
We now check for any button presses, and truncate the
spelled-out string in that case.
Change-Id: Ibbd4f630cb5b88c9c133fdaf3a591e1a38f61e82
This commit is contained in:
parent
c51ca1eeb5
commit
ae1dc0adf8
1 changed files with 10 additions and 2 deletions
12
apps/talk.c
12
apps/talk.c
|
@ -752,6 +752,7 @@ static void do_enqueue(bool enqueue)
|
|||
static int _talk_spell(const char* spell, size_t len, bool enqueue)
|
||||
{
|
||||
char c; /* currently processed char */
|
||||
int button = BUTTON_NONE;
|
||||
|
||||
if (talk_is_disabled())
|
||||
return -1;
|
||||
|
@ -780,8 +781,15 @@ static int _talk_spell(const char* spell, size_t len, bool enqueue)
|
|||
else if (c == PATH_SEPCH)
|
||||
talk_id(VOICE_CHAR_SLASH, true);
|
||||
|
||||
while (QUEUE_LEVEL == QUEUE_SIZE - 1) /* queue full - busy loop */
|
||||
yield();
|
||||
|
||||
if (QUEUE_LEVEL == QUEUE_SIZE - 1)
|
||||
button = button_get(false); /* prevent UI unresponsiveness */
|
||||
|
||||
if (button == BUTTON_NONE || IS_SYSEVENT(button))
|
||||
while (QUEUE_LEVEL == QUEUE_SIZE - 1) /* queue full - busy loop */
|
||||
yield();
|
||||
else
|
||||
return 0; /* truncate spelled-out string */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue