forked from len0rd/rockbox
Add Invalid Voice Announcement to the voice system FS#13216
When a voice file is invalid or fails to load the voice system splash a message 'Invalid Voice' Now we supply a single voice file (currently only english is used) the support for other languages is in but I haven't set it up to look for anything but InvalidVoice_english.talk Also adds a one time kill voice thread function ie. it doesn't allow re-init after killing the voice thread & queue Change-Id: I7b43f340c3cc65c65110190f0e0075b31218a7ac
This commit is contained in:
parent
c528c01312
commit
2ffe87902d
9 changed files with 90 additions and 12 deletions
|
@ -106,6 +106,7 @@ enum voice_state
|
|||
VOICE_STATE_MESSAGE = 0,
|
||||
VOICE_STATE_DECODE,
|
||||
VOICE_STATE_BUFFER_INSERT,
|
||||
VOICE_STATE_QUIT,
|
||||
};
|
||||
|
||||
/* A delay to not bring audio back to normal level too soon */
|
||||
|
@ -115,6 +116,7 @@ enum voice_thread_messages
|
|||
{
|
||||
Q_VOICE_PLAY = 0, /* Play a clip */
|
||||
Q_VOICE_STOP, /* Stop current clip */
|
||||
Q_VOICE_KILL, /* Kill voice thread till restart*/
|
||||
};
|
||||
|
||||
/* Structure to store clip data callback info */
|
||||
|
@ -383,7 +385,9 @@ static enum voice_state voice_message(struct voice_thread_data *td)
|
|||
speex_decoder_ctl(td->st, SPEEX_GET_LOOKAHEAD, &td->lookahead);
|
||||
|
||||
return VOICE_STATE_DECODE;
|
||||
|
||||
case Q_VOICE_KILL:
|
||||
queue_delete(&voice_queue);
|
||||
return VOICE_STATE_QUIT;
|
||||
case SYS_TIMEOUT:
|
||||
if (voice_unplayed_frames())
|
||||
{
|
||||
|
@ -512,7 +516,7 @@ static enum voice_state voice_buffer_insert(struct voice_thread_data *td)
|
|||
}
|
||||
|
||||
/* Voice thread entrypoint */
|
||||
static void NORETURN_ATTR voice_thread(void)
|
||||
static void voice_thread(void)
|
||||
{
|
||||
struct voice_thread_data td;
|
||||
enum voice_state state = VOICE_STATE_MESSAGE;
|
||||
|
@ -532,8 +536,20 @@ static void NORETURN_ATTR voice_thread(void)
|
|||
case VOICE_STATE_BUFFER_INSERT:
|
||||
state = voice_buffer_insert(&td);
|
||||
break;
|
||||
case VOICE_STATE_QUIT:
|
||||
logf("Exiting voice thread");
|
||||
core_free(voice_buf_hid);
|
||||
voice_buf_hid = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* kill voice thread and dont allow re-init*/
|
||||
void voice_thread_kill(void)
|
||||
{
|
||||
queue_send(&voice_queue, Q_VOICE_KILL, 0);
|
||||
}
|
||||
|
||||
/* Initialize buffers, all synchronization objects and create the thread */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue