summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTomasz Malesinski <tomal@rockbox.org>2007-09-22 22:47:12 +0000
committerTomasz Malesinski <tomal@rockbox.org>2007-09-22 22:47:12 +0000
commit8f8dbf47426e59328dda394b15db6fac2442e8e1 (patch)
tree551bf12868f293edc307fb57bb28614a74720655 /apps
parentf2ca1e8a7d513041e7f878a640083396aa7a180d (diff)
downloadrockbox-8f8dbf47426e59328dda394b15db6fac2442e8e1.tar.gz
rockbox-8f8dbf47426e59328dda394b15db6fac2442e8e1.zip
Fix disabling voice.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14821 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 85aaad2e08..9bdcbac213 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -391,7 +391,11 @@ void mp3_play_pause(bool play)
391 391
392bool mp3_is_playing(void) 392bool mp3_is_playing(void)
393{ 393{
394#ifdef PLAYBACK_VOICE
394 return voice_is_playing; 395 return voice_is_playing;
396#else
397 return false;
398#endif
395} 399}
396 400
397/* If voice could be swapped out - wait for it to return 401/* If voice could be swapped out - wait for it to return
@@ -425,7 +429,9 @@ unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size)
425 { 429 {
426 audio_hard_stop(); 430 audio_hard_stop();
427 wait_for_voice_swap_in(); 431 wait_for_voice_swap_in();
432#ifdef PLAYBACK_VOICE
428 voice_stop(); 433 voice_stop();
434#endif
429 } 435 }
430 /* else buffer_state will be BUFFER_STATE_TRASHED at this point */ 436 /* else buffer_state will be BUFFER_STATE_TRASHED at this point */
431 437
@@ -521,7 +527,9 @@ unsigned char *audio_get_recording_buffer(size_t *buffer_size)
521 of pending events to ensure trouble-free operation of encoders */ 527 of pending events to ensure trouble-free operation of encoders */
522 audio_hard_stop(); 528 audio_hard_stop();
523 wait_for_voice_swap_in(); 529 wait_for_voice_swap_in();
530#ifdef PLAYBACK_VOICE
524 voice_stop(); 531 voice_stop();
532#endif
525 talk_buffer_steal(); 533 talk_buffer_steal();
526 534
527#ifdef PLAYBACK_VOICE 535#ifdef PLAYBACK_VOICE
@@ -931,7 +939,6 @@ static void swap_codec(void)
931 before it is called */ 939 before it is called */
932static void voice_stop(void) 940static void voice_stop(void)
933{ 941{
934#ifdef PLAYBACK_VOICE
935 /* Must have a voice codec loaded or we'll hang forever here */ 942 /* Must have a voice codec loaded or we'll hang forever here */
936 if (!voice_codec_loaded) 943 if (!voice_codec_loaded)
937 return; 944 return;
@@ -947,7 +954,6 @@ static void voice_stop(void)
947 954
948 if (!playing) 955 if (!playing)
949 pcmbuf_play_stop(); 956 pcmbuf_play_stop();
950#endif
951} /* voice_stop */ 957} /* voice_stop */
952 958
953/* Is voice still speaking */ 959/* Is voice still speaking */
@@ -959,16 +965,18 @@ static bool is_voice_speaking(void)
959 || (!playing && pcm_is_playing()); 965 || (!playing && pcm_is_playing());
960} 966}
961 967
968#endif /* PLAYBACK_VOICE */
969
962/* Wait for voice to finish speaking. */ 970/* Wait for voice to finish speaking. */
963/* Also only reliable when music is not also playing. */ 971/* Also only reliable when music is not also playing. */
964void voice_wait(void) 972void voice_wait(void)
965{ 973{
974#ifdef PLAYBACK_VOICE
966 while (is_voice_speaking()) 975 while (is_voice_speaking())
967 sleep(HZ/10); 976 sleep(HZ/10);
977#endif
968} 978}
969 979
970#endif /* PLAYBACK_VOICE */
971
972static void set_filebuf_watermark(int seconds) 980static void set_filebuf_watermark(int seconds)
973{ 981{
974 size_t bytes; 982 size_t bytes;