1
0
Fork 0
forked from len0rd/rockbox

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) 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 #ifdef PLAYBACK_VOICE
LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
queue_post(&voice_queue, Q_VOICE_STOP, (void *)1); queue_post(&voice_queue, Q_VOICE_STOP, (void *)1);
@ -445,6 +437,15 @@ bool audio_has_changed_track(void)
void audio_play(long offset) void audio_play(long offset)
{ {
logf("audio_play"); 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) if (playing && offset <= 0)
{ {
LOGFQUEUE("audio > audio Q_AUDIO_NEW_PLAYLIST"); LOGFQUEUE("audio > audio Q_AUDIO_NEW_PLAYLIST");
@ -457,14 +458,19 @@ void audio_play(long offset)
LOGFQUEUE("audio > audio Q_AUDIO_PLAY"); LOGFQUEUE("audio > audio Q_AUDIO_PLAY");
queue_post(&audio_queue, Q_AUDIO_PLAY, (void *)offset); queue_post(&audio_queue, Q_AUDIO_PLAY, (void *)offset);
} }
/* Don't return until playback has actually started */
while (!playing) while (!playing)
yield(); yield();
} }
void audio_stop(void) void audio_stop(void)
{ {
/* Stop playback */
LOGFQUEUE("audio > audio Q_AUDIO_STOP"); LOGFQUEUE("audio > audio Q_AUDIO_STOP");
queue_post(&audio_queue, Q_AUDIO_STOP, 0); queue_post(&audio_queue, Q_AUDIO_STOP, 0);
/* Don't return until playback has actually stopped */
while(playing) while(playing)
yield(); 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, void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3,
bool last_track)); bool last_track));
void voice_init(void); void voice_init(void);
void mp3_play_abort(void);
void voice_stop(void); void voice_stop(void);
#if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */ #if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */

View file

@ -311,11 +311,10 @@ re_check:
else else
{ {
*size = 0; /* end of data */ *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) static int shutup(void)
{ {
#if CONFIG_CODEC != SWCODEC #if CONFIG_CODEC != SWCODEC
@ -327,7 +326,7 @@ static int shutup(void)
if (QUEUE_LEVEL == 0) /* has ended anyway */ if (QUEUE_LEVEL == 0) /* has ended anyway */
{ {
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
mp3_play_abort(); mp3_play_stop();
#endif #endif
return 0; return 0;
} }
@ -375,11 +374,7 @@ static int shutup(void)
#endif #endif
/* nothing to do, was frame boundary or not our clip */ /* nothing to do, was frame boundary or not our clip */
#if CONFIG_CODEC == SWCODEC
mp3_play_abort();
#else
mp3_play_stop(); mp3_play_stop();
#endif
queue_write = queue_read = 0; /* reset the queue */ queue_write = queue_read = 0; /* reset the queue */