summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2006-10-25 06:19:27 +0000
committerSteve Bavin <pondlife@pondlife.me>2006-10-25 06:19:27 +0000
commitf512558650175b8834d3a2125d4d3d5a3df78606 (patch)
tree02ff47f4b554e86eb08e5912b32ae6112eec4076
parentb26e396436971b73c8a40f50121c404d643daf51 (diff)
downloadrockbox-f512558650175b8834d3a2125d4d3d5a3df78606.tar.gz
rockbox-f512558650175b8834d3a2125d4d3d5a3df78606.zip
Only flush PCM buffered voice data when explicitly told to. Patch by Stephane Doyen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11331 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playback.c18
-rw-r--r--apps/playback.h2
-rw-r--r--apps/talk.c11
-rw-r--r--docs/CREDITS1
4 files changed, 25 insertions, 7 deletions
diff --git a/apps/playback.c b/apps/playback.c
index ddb6019537..db47b0be6f 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -328,6 +328,14 @@ void mp3_play_stop(void)
328#endif 328#endif
329} 329}
330 330
331void mp3_play_abort(void)
332{
333#ifdef PLAYBACK_VOICE
334 LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
335 queue_post(&voice_queue, Q_VOICE_STOP, (void *)1);
336#endif
337}
338
331bool mp3_pause_done(void) 339bool mp3_pause_done(void)
332{ 340{
333 return pcm_is_paused(); 341 return pcm_is_paused();
@@ -952,6 +960,10 @@ static void* voice_request_buffer_callback(size_t *realsize, size_t reqsize)
952 960
953 case Q_VOICE_STOP: 961 case Q_VOICE_STOP:
954 LOGFQUEUE("voice < Q_VOICE_STOP"); 962 LOGFQUEUE("voice < Q_VOICE_STOP");
963 if (ev.data == (void *)1 && !playing && pcm_is_playing())
964 /* Aborting: Slight hack - flush PCM buffer if
965 only being used for voice */
966 pcmbuf_play_stop();
955 if (voice_is_playing) 967 if (voice_is_playing)
956 { 968 {
957 /* Clear the current buffer */ 969 /* Clear the current buffer */
@@ -980,10 +992,6 @@ static void* voice_request_buffer_callback(size_t *realsize, size_t reqsize)
980 LOGFQUEUE("voice < Q_VOICE_PLAY"); 992 LOGFQUEUE("voice < Q_VOICE_PLAY");
981 if (!voice_is_playing) 993 if (!voice_is_playing)
982 { 994 {
983 /* Slight hack - flush PCM buffer if only being used for voice */
984 if (!playing && pcm_is_playing())
985 pcmbuf_play_stop();
986
987 /* Set up new voice data */ 995 /* Set up new voice data */
988 struct voice_info *voice_data; 996 struct voice_info *voice_data;
989 voice_is_playing = true; 997 voice_is_playing = true;
@@ -3018,7 +3026,7 @@ static void audio_play_start(size_t offset)
3018 3026
3019 3027
3020/* Invalidates all but currently playing track. */ 3028/* Invalidates all but currently playing track. */
3021void audio_invalidate_tracks(void) 3029static void audio_invalidate_tracks(void)
3022{ 3030{
3023 if (audio_have_tracks()) { 3031 if (audio_have_tracks()) {
3024 last_peek_offset = 0; 3032 last_peek_offset = 0;
diff --git a/apps/playback.h b/apps/playback.h
index decb709384..6d66581fa9 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -64,8 +64,8 @@ void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3,
64 bool last_track)); 64 bool last_track));
65void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3, 65void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3,
66 bool last_track)); 66 bool last_track));
67void audio_invalidate_tracks(void);
68void voice_init(void); 67void voice_init(void);
68void mp3_play_abort(void);
69void voice_stop(void); 69void voice_stop(void);
70 70
71#if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */ 71#if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */
diff --git a/apps/talk.c b/apps/talk.c
index d03fead233..b5fa06d750 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -318,14 +318,20 @@ re_check:
318/* stop the playback and the pending clips, but at frame boundary */ 318/* stop the playback and the pending clips, but at frame boundary */
319static int shutup(void) 319static int shutup(void)
320{ 320{
321#if CONFIG_CODEC != SWCODEC
321 unsigned char* pos; 322 unsigned char* pos;
322 unsigned char* search; 323 unsigned char* search;
323 unsigned char* end; 324 unsigned char* end;
325#endif
324 326
325 if (QUEUE_LEVEL == 0) /* has ended anyway */ 327 if (QUEUE_LEVEL == 0) /* has ended anyway */
326 { 328 {
329#if CONFIG_CODEC == SWCODEC
330 mp3_play_abort();
331#endif
327 return 0; 332 return 0;
328 } 333 }
334#if CONFIG_CODEC != SWCODEC
329#if CONFIG_CPU == SH7034 335#if CONFIG_CPU == SH7034
330 CHCR3 &= ~0x0001; /* disable the DMA (and therefore the interrupt also) */ 336 CHCR3 &= ~0x0001; /* disable the DMA (and therefore the interrupt also) */
331#endif 337#endif
@@ -366,9 +372,12 @@ static int shutup(void)
366 return 0; 372 return 0;
367 } 373 }
368 } 374 }
375#endif
369 376
370 /* nothing to do, was frame boundary or not our clip */ 377 /* nothing to do, was frame boundary or not our clip */
371 mp3_play_stop(); 378#if CONFIG_CODEC == SWCODEC
379 mp3_play_abort();
380#endif
372 queue_write = queue_read = 0; /* reset the queue */ 381 queue_write = queue_read = 0; /* reset the queue */
373 382
374 return 0; 383 return 0;
diff --git a/docs/CREDITS b/docs/CREDITS
index e70dcab317..b39c9c6009 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -243,3 +243,4 @@ Robert Kukla
243David Quesada 243David Quesada
244Jared Stafford 244Jared Stafford
245Martin Hensel 245Martin Hensel
246Stéphane Doyen