From 441fa76a6d23128169ed6c3768f014808df88329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Wallm=C3=A9nius?= Date: Wed, 29 Aug 2007 15:11:19 +0000 Subject: Fix flushing of voice during playback, patch in FS#6239 by Stephane Doyon and Daniel Dalton git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14517 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 6 ++---- apps/talk.c | 3 +-- apps/talk.h | 4 +--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/apps/playback.c b/apps/playback.c index 13167e3ffe..b7d3b9987f 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -658,8 +658,7 @@ void audio_play(long offset) #ifdef PLAYBACK_VOICE /* Truncate any existing voice output so we don't have spelling * etc. over the first part of the played track */ - LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); - queue_post(&voice_queue, Q_VOICE_STOP, 1); + do_shutup(); #endif /* Start playback */ @@ -943,8 +942,7 @@ static void voice_stop(void) if (!voice_codec_loaded) return; - LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); - queue_post(&voice_queue, Q_VOICE_STOP, 0); + do_shutup(); /* Loop until voice empties it's queue, stops and picks up on the new track; the voice thread must be stopped and waiting for messages diff --git a/apps/talk.c b/apps/talk.c index 9e73f71084..b9d5bc2aa7 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -141,7 +141,6 @@ static int queue_clip(unsigned char* buf, long size, bool enqueue); static int open_voicefile(void); static unsigned char* get_clip(long id, long* p_size); static int shutup(void); /* Interrupt voice, as when enqueue is false */ -static int do_shutup(void); /* kill voice unconditionally */ /***************** Private implementation *****************/ @@ -311,7 +310,7 @@ re_check: } /* stop the playback and the pending clips */ -static int do_shutup(void) +int do_shutup(void) { #if CONFIG_CODEC != SWCODEC unsigned char* pos; diff --git a/apps/talk.h b/apps/talk.h index b016acba59..75ab6fca7e 100644 --- a/apps/talk.h +++ b/apps/talk.h @@ -76,9 +76,7 @@ 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); /* disable voice menus (temporarily, not persisted) */ void talk_enable_menus(void); /* re-enable voice menus */ - - - +int do_shutup(void); /* kill voice unconditionally */ /* This (otherwise invalid) ID signals the end of the array. */ #define TALK_FINAL_ID LANG_LAST_INDEX_IN_ARRAY -- cgit v1.2.3