diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-08-23 08:21:15 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-08-23 08:21:15 +0000 |
commit | 97b56a665c9aafee634ee5ffd6fa86fd2f9c7dd9 (patch) | |
tree | 2abad5a833bc3ea81bc1661a0ae78a5e7044f854 /apps/talk.c | |
parent | 8a3b6dad94a471f82ae39ed6507074f3c83caf7c (diff) | |
download | rockbox-97b56a665c9aafee634ee5ffd6fa86fd2f9c7dd9.tar.gz rockbox-97b56a665c9aafee634ee5ffd6fa86fd2f9c7dd9.zip |
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
Diffstat (limited to 'apps/talk.c')
-rw-r--r-- | apps/talk.c | 16 |
1 files changed, 8 insertions, 8 deletions
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 @@ | |||
38 | #if CONFIG_CODEC == SWCODEC | 38 | #if CONFIG_CODEC == SWCODEC |
39 | #include "playback.h" | 39 | #include "playback.h" |
40 | #endif | 40 | #endif |
41 | #include "debug.h" | ||
41 | 42 | ||
42 | 43 | ||
43 | /* Memory layout varies between targets because the | 44 | /* Memory layout varies between targets because the |
@@ -47,7 +48,7 @@ | |||
47 | (playing) | (stopped) | | 48 | (playing) | (stopped) | |
48 | audiobuf-----------+-----------+----------- | 49 | audiobuf-----------+-----------+----------- |
49 | audio | voice | thumbnail | 50 | audio | voice | thumbnail |
50 | |-----------|----------- | 51 | |-----------|----------- filebuf |
51 | | thumbnail | voice | 52 | | thumbnail | voice |
52 | | |----------- | 53 | | |----------- |
53 | | | audio | 54 | | | audio |
@@ -189,12 +190,10 @@ static void load_voicefile(void) | |||
189 | if (((struct voicefile*)audiobuf)->table /* format check */ | 190 | if (((struct voicefile*)audiobuf)->table /* format check */ |
190 | == offsetof(struct voicefile, index)) | 191 | == offsetof(struct voicefile, index)) |
191 | { | 192 | { |
192 | #if CONFIG_CODEC == SWCODEC | ||
193 | /* SWCODEC: allocate permanent buffer */ | ||
194 | p_voicefile = (struct voicefile*)buffer_alloc(file_size); | ||
195 | #else | ||
196 | /* MASCODEC: now use audiobuf for voice then thumbnail */ | ||
197 | p_voicefile = (struct voicefile*)audiobuf; | 193 | p_voicefile = (struct voicefile*)audiobuf; |
194 | |||
195 | #if CONFIG_CODEC != SWCODEC | ||
196 | /* MASCODEC: now use audiobuf for voice then thumbnail */ | ||
198 | p_thumbnail = audiobuf + file_size; | 197 | p_thumbnail = audiobuf + file_size; |
199 | p_thumbnail += (long)p_thumbnail % 2; /* 16-bit align */ | 198 | p_thumbnail += (long)p_thumbnail % 2; /* 16-bit align */ |
200 | size_for_thumbnail = audiobufend - p_thumbnail; | 199 | size_for_thumbnail = audiobufend - p_thumbnail; |
@@ -526,13 +525,14 @@ void talk_init(void) | |||
526 | close(filehandle); /* close again, this was just to detect presence */ | 525 | close(filehandle); /* close again, this was just to detect presence */ |
527 | filehandle = -1; | 526 | filehandle = -1; |
528 | } | 527 | } |
528 | |||
529 | } | 529 | } |
530 | 530 | ||
531 | /* return if a voice codec is required or not */ | 531 | /* return if a voice codec is required or not */ |
532 | bool talk_voice_required(void) | 532 | bool talk_voice_required(void) |
533 | { | 533 | { |
534 | return (voicefile_size != 0) | 534 | return (voicefile_size != 0) /* Voice file is available */ |
535 | || (global_settings.talk_dir == 3) | 535 | || (global_settings.talk_dir == 3) /* Thumbnail clips are required */ |
536 | || (global_settings.talk_file == 3); | 536 | || (global_settings.talk_file == 3); |
537 | } | 537 | } |
538 | 538 | ||