summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c22
-rw-r--r--apps/playback.h1
-rw-r--r--apps/talk.c9
3 files changed, 16 insertions, 16 deletions
diff --git a/apps/playback.c b/apps/playback.c
index db47b0b..b68a8b8 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -324,14 +324,6 @@ 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);
#endif
}
@@ -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 6d66581..ccf8b58 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 fd28fdf..d81aa08 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 */