From 71dd94a7eb42dfc29d8b454d00df6debd7d34a65 Mon Sep 17 00:00:00 2001 From: Steve Bavin Date: Wed, 25 Oct 2006 08:54:25 +0000 Subject: A bit more voice simplification/MAS fixage (FS#6241). Also clear any buffered voice when playback is started. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11334 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 22 ++++++++++++++-------- apps/playback.h | 1 - apps/talk.c | 9 ++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/playback.c b/apps/playback.c index db47b0be6f..b68a8b81f1 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -322,14 +322,6 @@ void mp3_play_data(const unsigned char* start, int size, void mp3_play_stop(void) { -#ifdef PLAYBACK_VOICE - LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); - queue_post(&voice_queue, Q_VOICE_STOP, 0); -#endif -} - -void mp3_play_abort(void) -{ #ifdef PLAYBACK_VOICE LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); queue_post(&voice_queue, Q_VOICE_STOP, (void *)1); @@ -445,6 +437,15 @@ bool audio_has_changed_track(void) void audio_play(long offset) { logf("audio_play"); + +#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, (void *)1); +#endif + + /* Start playback */ if (playing && offset <= 0) { LOGFQUEUE("audio > audio Q_AUDIO_NEW_PLAYLIST"); @@ -457,14 +458,19 @@ void audio_play(long offset) LOGFQUEUE("audio > audio Q_AUDIO_PLAY"); queue_post(&audio_queue, Q_AUDIO_PLAY, (void *)offset); } + + /* Don't return until playback has actually started */ while (!playing) yield(); } void audio_stop(void) { + /* Stop playback */ LOGFQUEUE("audio > audio Q_AUDIO_STOP"); queue_post(&audio_queue, Q_AUDIO_STOP, 0); + + /* Don't return until playback has actually stopped */ while(playing) yield(); } diff --git a/apps/playback.h b/apps/playback.h index 6d66581fa9..ccf8b58472 100644 --- a/apps/playback.h +++ b/apps/playback.h @@ -65,7 +65,6 @@ void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3, void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3, bool last_track)); void voice_init(void); -void mp3_play_abort(void); void voice_stop(void); #if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */ diff --git a/apps/talk.c b/apps/talk.c index fd28fdfd71..d81aa082c9 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -311,11 +311,10 @@ re_check: else { *size = 0; /* end of data */ - mp3_play_stop(); /* fixme: should be done by caller */ } } -/* stop the playback and the pending clips, but at frame boundary */ +/* stop the playback and the pending clips */ static int shutup(void) { #if CONFIG_CODEC != SWCODEC @@ -327,7 +326,7 @@ static int shutup(void) if (QUEUE_LEVEL == 0) /* has ended anyway */ { #if CONFIG_CODEC == SWCODEC - mp3_play_abort(); + mp3_play_stop(); #endif return 0; } @@ -375,11 +374,7 @@ static int shutup(void) #endif /* nothing to do, was frame boundary or not our clip */ -#if CONFIG_CODEC == SWCODEC - mp3_play_abort(); -#else mp3_play_stop(); -#endif queue_write = queue_read = 0; /* reset the queue */ -- cgit v1.2.3