summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-29 07:14:58 +0100
committerThomas Martitz <kugel@rockbox.org>2014-02-02 19:40:39 +0100
commit57000b513bd54b9dba3b308b7734c88962b81ae3 (patch)
tree925ae0106fd68f1b5cd77fd89aa48eaa7e35bf9b
parent60dea95cad710095477a2f5e35bd5692f79f76da (diff)
downloadrockbox-57000b513bd54b9dba3b308b7734c88962b81ae3.tar.gz
rockbox-57000b513bd54b9dba3b308b7734c88962b81ae3.zip
talk: Make talk_voice_required() local to talk.c
Change-Id: I3a04760d550efab7f011a917597ef29c039b05bd
-rw-r--r--apps/talk.c26
-rw-r--r--apps/talk.h3
-rw-r--r--apps/voice_thread.c6
3 files changed, 13 insertions, 22 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 2dcaf91420..88d9afab90 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -797,6 +797,16 @@ static void queue_clip(unsigned long clip_offset, long size, bool enqueue)
797 return; 797 return;
798} 798}
799 799
800#if CONFIG_CODEC == SWCODEC
801/* return if a voice codec is required or not */
802static bool talk_voice_required(void)
803{
804 return (has_voicefile) /* Voice file is available */
805 || (global_settings.talk_dir_clip) /* Thumbnail clips are required */
806 || (global_settings.talk_file_clip);
807}
808#endif
809
800/***************** Public implementation *****************/ 810/***************** Public implementation *****************/
801 811
802void talk_init(void) 812void talk_init(void)
@@ -877,9 +887,9 @@ void talk_init(void)
877#endif 887#endif
878 888
879#if CONFIG_CODEC == SWCODEC 889#if CONFIG_CODEC == SWCODEC
880 /* Safe to init voice playback engine now since we now know if talk is 890 /* Initialize the actual voice clip playback engine as well */
881 required or not */ 891 if (talk_voice_required())
882 voice_thread_init(); 892 voice_thread_init();
883#endif 893#endif
884 894
885out: 895out:
@@ -887,16 +897,6 @@ out:
887 filehandle = -1; 897 filehandle = -1;
888} 898}
889 899
890#if CONFIG_CODEC == SWCODEC
891/* return if a voice codec is required or not */
892bool talk_voice_required(void)
893{
894 return (has_voicefile) /* Voice file is available */
895 || (global_settings.talk_dir_clip) /* Thumbnail clips are required */
896 || (global_settings.talk_file_clip);
897}
898#endif
899
900/* somebody else claims the mp3 buffer, e.g. for regular play/record */ 900/* somebody else claims the mp3 buffer, e.g. for regular play/record */
901void talk_buffer_set_policy(int policy) 901void talk_buffer_set_policy(int policy)
902{ 902{
diff --git a/apps/talk.h b/apps/talk.h
index 28be71884f..4da3a61f3b 100644
--- a/apps/talk.h
+++ b/apps/talk.h
@@ -96,9 +96,6 @@ extern const char* const dir_thumbnail_name; /* "_dirname.talk" */
96extern const char* const file_thumbnail_ext; /* ".talk" for file voicing */ 96extern const char* const file_thumbnail_ext; /* ".talk" for file voicing */
97 97
98void talk_init(void); 98void talk_init(void);
99#if CONFIG_CODEC == SWCODEC
100bool talk_voice_required(void); /* returns true if voice codec required */
101#endif
102int talk_get_bufsize(void); /* get the loaded voice file size */ 99int talk_get_bufsize(void); /* get the loaded voice file size */
103size_t talkbuf_init(char* bufstart); 100size_t talkbuf_init(char* bufstart);
104bool is_voice_queued(void); /* Are there more voice clips to be spoken? */ 101bool is_voice_queued(void); /* Are there more voice clips to be spoken? */
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 3b6fe5b3ba..72ecb3741e 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -526,12 +526,6 @@ void voice_thread_init(void)
526 if (voice_thread_id != 0) 526 if (voice_thread_id != 0)
527 return; /* Already did an init and succeeded at it */ 527 return; /* Already did an init and succeeded at it */
528 528
529 if (!talk_voice_required())
530 {
531 logf("No voice required");
532 return;
533 }
534
535 voice_buf_hid = core_alloc_ex("voice buf", sizeof (*voice_buf), &ops); 529 voice_buf_hid = core_alloc_ex("voice buf", sizeof (*voice_buf), &ops);
536 530
537 if (voice_buf_hid <= 0) 531 if (voice_buf_hid <= 0)