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
This commit is contained in:
Steve Bavin 2006-10-25 08:54:25 +00:00
parent ff5fd00de6
commit 71dd94a7eb
3 changed files with 16 additions and 16 deletions

View file

@ -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();
}

View file

@ -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 */

View file

@ -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 */