From 97b56a665c9aafee634ee5ffd6fa86fd2f9c7dd9 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 23 Aug 2006 08:21:15 +0000 Subject: Patch #5844 by Steve Bavin - Fix confused voice file memory allocation git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10711 a1c6a512-1295-4272-9138-f99709370657 --- apps/talk.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'apps/talk.c') diff --git a/apps/talk.c b/apps/talk.c index 8f507eb700..cf68cdf021 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -38,6 +38,7 @@ #if CONFIG_CODEC == SWCODEC #include "playback.h" #endif +#include "debug.h" /* Memory layout varies between targets because the @@ -47,7 +48,7 @@ (playing) | (stopped) | audiobuf-----------+-----------+----------- audio | voice | thumbnail - |-----------|----------- + |-----------|----------- filebuf | thumbnail | voice | |----------- | | audio @@ -189,12 +190,10 @@ static void load_voicefile(void) if (((struct voicefile*)audiobuf)->table /* format check */ == offsetof(struct voicefile, index)) { -#if CONFIG_CODEC == SWCODEC - /* SWCODEC: allocate permanent buffer */ - p_voicefile = (struct voicefile*)buffer_alloc(file_size); -#else - /* MASCODEC: now use audiobuf for voice then thumbnail */ p_voicefile = (struct voicefile*)audiobuf; + +#if CONFIG_CODEC != SWCODEC + /* MASCODEC: now use audiobuf for voice then thumbnail */ p_thumbnail = audiobuf + file_size; p_thumbnail += (long)p_thumbnail % 2; /* 16-bit align */ size_for_thumbnail = audiobufend - p_thumbnail; @@ -526,13 +525,14 @@ void talk_init(void) close(filehandle); /* close again, this was just to detect presence */ filehandle = -1; } + } /* return if a voice codec is required or not */ bool talk_voice_required(void) { - return (voicefile_size != 0) - || (global_settings.talk_dir == 3) + return (voicefile_size != 0) /* Voice file is available */ + || (global_settings.talk_dir == 3) /* Thumbnail clips are required */ || (global_settings.talk_file == 3); } -- cgit v1.2.3