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 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'apps/playback.c') 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(); } -- cgit v1.2.3