summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2006-10-25 08:54:25 +0000
committerSteve Bavin <pondlife@pondlife.me>2006-10-25 08:54:25 +0000
commit71dd94a7eb42dfc29d8b454d00df6debd7d34a65 (patch)
tree3135aba9bff781de7fe0632a330c3ca03a0544d1
parentff5fd00de683e9e1a0da24e75c8a5ad419516e32 (diff)
downloadrockbox-71dd94a7eb42dfc29d8b454d00df6debd7d34a65.tar.gz
rockbox-71dd94a7eb42dfc29d8b454d00df6debd7d34a65.zip
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
-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 db47b0be6f..b68a8b81f1 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -324,14 +324,6 @@ void mp3_play_stop(void)
324{ 324{
325#ifdef PLAYBACK_VOICE 325#ifdef PLAYBACK_VOICE
326 LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); 326 LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
327 queue_post(&voice_queue, Q_VOICE_STOP, 0);
328#endif
329}
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); 327 queue_post(&voice_queue, Q_VOICE_STOP, (void *)1);
336#endif 328#endif
337} 329}
@@ -445,6 +437,15 @@ bool audio_has_changed_track(void)
445void audio_play(long offset) 437void audio_play(long offset)
446{ 438{
447 logf("audio_play"); 439 logf("audio_play");
440
441#ifdef PLAYBACK_VOICE
442 /* Truncate any existing voice output so we don't have spelling
443 * etc. over the first part of the played track */
444 LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
445 queue_post(&voice_queue, Q_VOICE_STOP, (void *)1);
446#endif
447
448 /* Start playback */
448 if (playing && offset <= 0) 449 if (playing && offset <= 0)
449 { 450 {
450 LOGFQUEUE("audio > audio Q_AUDIO_NEW_PLAYLIST"); 451 LOGFQUEUE("audio > audio Q_AUDIO_NEW_PLAYLIST");
@@ -457,14 +458,19 @@ void audio_play(long offset)
457 LOGFQUEUE("audio > audio Q_AUDIO_PLAY"); 458 LOGFQUEUE("audio > audio Q_AUDIO_PLAY");
458 queue_post(&audio_queue, Q_AUDIO_PLAY, (void *)offset); 459 queue_post(&audio_queue, Q_AUDIO_PLAY, (void *)offset);
459 } 460 }
461
462 /* Don't return until playback has actually started */
460 while (!playing) 463 while (!playing)
461 yield(); 464 yield();
462} 465}
463 466
464void audio_stop(void) 467void audio_stop(void)
465{ 468{
469 /* Stop playback */
466 LOGFQUEUE("audio > audio Q_AUDIO_STOP"); 470 LOGFQUEUE("audio > audio Q_AUDIO_STOP");
467 queue_post(&audio_queue, Q_AUDIO_STOP, 0); 471 queue_post(&audio_queue, Q_AUDIO_STOP, 0);
472
473 /* Don't return until playback has actually stopped */
468 while(playing) 474 while(playing)
469 yield(); 475 yield();
470} 476}
diff --git a/apps/playback.h b/apps/playback.h
index 6d66581fa9..ccf8b58472 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -65,7 +65,6 @@ void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3,
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 voice_init(void); 67void voice_init(void);
68void mp3_play_abort(void);
69void voice_stop(void); 68void voice_stop(void);
70 69
71#if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */ 70#if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */
diff --git a/apps/talk.c b/apps/talk.c
index fd28fdfd71..d81aa082c9 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -311,11 +311,10 @@ re_check:
311 else 311 else
312 { 312 {
313 *size = 0; /* end of data */ 313 *size = 0; /* end of data */
314 mp3_play_stop(); /* fixme: should be done by caller */
315 } 314 }
316} 315}
317 316
318/* stop the playback and the pending clips, but at frame boundary */ 317/* stop the playback and the pending clips */
319static int shutup(void) 318static int shutup(void)
320{ 319{
321#if CONFIG_CODEC != SWCODEC 320#if CONFIG_CODEC != SWCODEC
@@ -327,7 +326,7 @@ static int shutup(void)
327 if (QUEUE_LEVEL == 0) /* has ended anyway */ 326 if (QUEUE_LEVEL == 0) /* has ended anyway */
328 { 327 {
329#if CONFIG_CODEC == SWCODEC 328#if CONFIG_CODEC == SWCODEC
330 mp3_play_abort(); 329 mp3_play_stop();
331#endif 330#endif
332 return 0; 331 return 0;
333 } 332 }
@@ -375,11 +374,7 @@ static int shutup(void)
375#endif 374#endif
376 375
377 /* nothing to do, was frame boundary or not our clip */ 376 /* nothing to do, was frame boundary or not our clip */
378#if CONFIG_CODEC == SWCODEC
379 mp3_play_abort();
380#else
381 mp3_play_stop(); 377 mp3_play_stop();
382#endif
383 378
384 queue_write = queue_read = 0; /* reset the queue */ 379 queue_write = queue_read = 0; /* reset the queue */
385 380