From d6f2a5465430bb9c5d020d370e3bb419f616c2ea Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Mon, 19 Nov 2007 11:59:52 +0000 Subject: [PATCH] Make sure initial menu item is voiced at startup. Voice thread must wait for the audio thread to finish initializing hardware. A known issue at speex commit time (perhaps only by myself ;). The behavioral refinement time begins. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15682 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 9 +++++++++ apps/voice_thread.c | 4 +--- firmware/export/audio.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/playback.c b/apps/playback.c index eac5307acc..20f8d4fdf7 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -127,6 +127,7 @@ #endif enum { + Q_NULL = 0, Q_AUDIO_PLAY = 1, Q_AUDIO_STOP, Q_AUDIO_PAUSE, @@ -2623,3 +2624,11 @@ void audio_init(void) thread_thaw(audio_thread_p); } /* audio_init */ + +/* Wait until audio thread can respond to messages - this implies + * it has finished initialization */ +void audio_wait_for_init(void) +{ + LOGFQUEUE("audio >| Q_NULL"); + queue_send(&audio_queue, Q_NULL, 0); +} diff --git a/apps/voice_thread.c b/apps/voice_thread.c index 52d2c6ebfd..9e7478651e 100644 --- a/apps/voice_thread.c +++ b/apps/voice_thread.c @@ -286,6 +286,7 @@ static void voice_thread(void) struct voice_thread_data td; voice_data_init(&td); + audio_wait_for_init(); goto message_wait; @@ -430,9 +431,6 @@ void voice_thread_resume(void) { logf("Thawing voice thread"); thread_thaw(voice_thread_p); - /* Wait for initialization to complete (a very short wait until the - * voice thread is available to process messages) */ - queue_send(&voice_queue, Q_VOICE_NULL, 0); } #ifdef HAVE_PRIORITY_SCHEDULING diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 061b2230f4..c39fca428c 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h @@ -77,6 +77,7 @@ struct audio_debug }; void audio_init(void); +void audio_wait_for_init(void); void audio_play(long offset); void audio_stop(void); void audio_pause(void);