summaryrefslogtreecommitdiff
path: root/apps/talk.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-10-26 18:31:19 +0000
committerThomas Martitz <kugel@rockbox.org>2011-10-26 18:31:19 +0000
commit5d5177931ea6fafcc09b59ea356a89fcd7759756 (patch)
treee5433d0103bbd56def1e6aa50779444e5ddeb3be /apps/talk.c
parentd3c21023e0fe00db6bff1e4e54a036d182377c1f (diff)
downloadrockbox-5d5177931ea6fafcc09b59ea356a89fcd7759756.tar.gz
rockbox-5d5177931ea6fafcc09b59ea356a89fcd7759756.zip
Fix FS#12241. Voice stopped working after audio_get_buffer() calls.
Since r30308 the talk buffer was set to NULL if e.g. a plugin called audio_get_buffer() to steal the talk buffer. Since there's no audio_release_buffer() kind of function the talk buffer was never set back again. When trying to talk try to get the audio buffer with audio_get_buffer() as well, which works until the audio buffer gets properly reinitialized. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30840 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/talk.c')
-rw-r--r--apps/talk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/talk.c b/apps/talk.c
index a11f830665..ed262b8094 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -778,6 +778,7 @@ void talk_buffer_steal(void)
778int talk_id(int32_t id, bool enqueue) 778int talk_id(int32_t id, bool enqueue)
779{ 779{
780 long clipsize; 780 long clipsize;
781 size_t temp;
781 unsigned char* clipbuf; 782 unsigned char* clipbuf;
782 int32_t unit; 783 int32_t unit;
783 int decimals; 784 int decimals;
@@ -789,8 +790,12 @@ int talk_id(int32_t id, bool enqueue)
789 return -1; 790 return -1;
790#endif 791#endif
791 792
793 /* try to get audio buffer until talkbuf_init() is called */
794 if (!voicebuf)
795 voicebuf = audio_get_buffer(true, &temp);
796
792 if (p_voicefile == NULL && has_voicefile) 797 if (p_voicefile == NULL && has_voicefile)
793 load_voicefile(false, voicebuf, voicefile_size); /* reload needed */ 798 load_voicefile(false, voicebuf, MIN(voicefile_size,temp)); /* reload needed */
794 799
795 if (p_voicefile == NULL) /* still no voices? */ 800 if (p_voicefile == NULL) /* still no voices? */
796 return -1; 801 return -1;