summaryrefslogtreecommitdiffstats
path: root/apps/talk.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-08-22 10:23:11 +0000
committerThomas Martitz <kugel@rockbox.org>2011-08-22 10:23:11 +0000
commitfbde6baab59d7c8d047ef267884373d6d9f9e59d (patch)
treedcc35ded25cd22218c61b545b5a44d5f91ca6c08 /apps/talk.c
parentb66d07a9e3a27af3a6b4d2cba8e7909b9beab46d (diff)
downloadrockbox-fbde6baab59d7c8d047ef267884373d6d9f9e59d.tar.gz
rockbox-fbde6baab59d7c8d047ef267884373d6d9f9e59d.tar.bz2
rockbox-fbde6baab59d7c8d047ef267884373d6d9f9e59d.zip
Move stuff a bit down to fix red on TALK_PARTIAL_LOAD.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30339 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/talk.c')
-rw-r--r--apps/talk.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 2f15ebce49..0c3b769d82 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -354,14 +354,6 @@ static void load_voicefile(bool probe, char* buf, size_t bufsize)
logf("Incompatible voice file");
goto load_err;
}
- p_thumbnail = voicebuf.buf + file_size;
- p_thumbnail += (long)p_thumbnail % 2; /* 16-bit align */
- size_for_thumbnail = voicebuf.buf + bufsize - p_thumbnail;
-#if CONFIG_CODEC == SWCODEC
- size_for_thumbnail = MIN(size_for_thumbnail, MAX_THUMBNAIL_BUFSIZE);
-#endif
- if (size_for_thumbnail <= 0)
- p_thumbnail = NULL;
}
else
goto load_err;
@@ -403,11 +395,26 @@ static void load_voicefile(bool probe, char* buf, size_t bufsize)
#ifdef TALK_PARTIAL_LOAD
alloc_size += silence_len + QUEUE_SIZE;
+#else
+ /* allocate for the entire file, TALK_PROGRESSIVE_LOAD doesn't
+ * load everything just yet */
+ alloc_size = file_size;
#endif
+
if (alloc_size > bufsize)
goto load_err;
return;
+ /* now move p_thumbnail behind the voice clip buffer */
+ p_thumbnail = voicebuf.buf + alloc_size;
+ p_thumbnail += (long)p_thumbnail % 2; /* 16-bit align */
+ size_for_thumbnail = voicebuf.buf + bufsize - p_thumbnail;
+#if CONFIG_CODEC == SWCODEC
+ size_for_thumbnail = MIN(size_for_thumbnail, MAX_THUMBNAIL_BUFSIZE);
+#endif
+ if (size_for_thumbnail <= 0)
+ p_thumbnail = NULL;
+
load_err:
p_voicefile = NULL;
has_voicefile = false; /* don't try again */