Index: apps/playback.c =================================================================== RCS file: /cvsroot/rockbox/apps/playback.c,v retrieving revision 1.339 diff -u -r1.339 playback.c --- apps/playback.c 13 Aug 2006 09:19:24 -0000 1.339 +++ apps/playback.c 15 Aug 2006 17:06:26 -0000 @@ -481,9 +481,13 @@ static void* get_codec_memory_callback(size_t *size) { *size = MALLOC_BUFSIZE; +#if CONFIG_CODEC != SWCODEC + /* MASCODEC cannot play audio and voice simultaneously, so its + voice strategy is different - see talk.c for details */ if (voice_codec_loaded) return &audiobuf[talk_get_bufsize()]; else +#endif return audiobuf; } @@ -2559,7 +2563,7 @@ filebuflen = audiobufend - audiobuf - MALLOC_BUFSIZE - GUARD_BUFSIZE - (pcmbuf_get_bufsize() + get_pcmbuf_descsize() + PCMBUF_MIX_CHUNK * 2); - if (talk_get_bufsize()) + if (talk_voice_required()) { filebuf = &filebuf[talk_get_bufsize()]; filebuflen -= 2*CODEC_IRAM_SIZE + 2*CODEC_SIZE + talk_get_bufsize(); @@ -2569,8 +2573,17 @@ iram_buf[1] = &filebuf[filebuflen+CODEC_IRAM_SIZE]; #endif dram_buf[0] = (unsigned char *)&filebuf[filebuflen+CODEC_IRAM_SIZE*2]; - dram_buf[1] = - (unsigned char *)&filebuf[filebuflen+CODEC_IRAM_SIZE*2+CODEC_SIZE]; + dram_buf[1] = (unsigned char *)&filebuf[filebuflen+CODEC_IRAM_SIZE*2+CODEC_SIZE]; + } + else + { + filebuf = &filebuf[talk_get_bufsize()]; + filebuflen -= CODEC_IRAM_SIZE + CODEC_SIZE + talk_get_bufsize(); + +#ifndef SIMULATOR + iram_buf[0] = &filebuf[filebuflen]; +#endif + dram_buf[0] = (unsigned char *)&filebuf[filebuflen+CODEC_IRAM_SIZE*2]; } /* Ensure that everything is aligned */ @@ -2616,8 +2629,8 @@ voice_codec_loaded = false; } - if (!talk_get_bufsize()) - return ; + if (!talk_voice_required()) + return; logf("Starting voice codec"); queue_init(&voice_codec_queue); Index: apps/settings_menu.c =================================================================== RCS file: /cvsroot/rockbox/apps/settings_menu.c,v retrieving revision 1.268 diff -u -r1.268 settings_menu.c --- apps/settings_menu.c 15 Aug 2006 09:38:13 -0000 1.268 +++ apps/settings_menu.c 15 Aug 2006 17:06:53 -0000 @@ -1264,16 +1264,20 @@ static bool voice_dirs(void) { - return set_option( str(LANG_VOICE_DIR), + bool ret = set_option( str(LANG_VOICE_DIR), &global_settings.talk_dir, INT, voice_names, 4, NULL); + audio_set_crossfade(global_settings.crossfade); + return ret; } static bool voice_files(void) { int oldval = global_settings.talk_file; bool ret; + ret = set_option( str(LANG_VOICE_FILE), &global_settings.talk_file, INT, voice_names, 4, NULL); + audio_set_crossfade(global_settings.crossfade); if (oldval != 3 && global_settings.talk_file == 3) { /* force reload if newly talking thumbnails, because the clip presence is cached only if enabled */ @@ -1462,9 +1466,7 @@ ret=set_option( str(LANG_CROSSFADE_ENABLE), &global_settings.crossfade, INT, names, 4, NULL); - audio_set_crossfade(global_settings.crossfade); - return ret; } Index: apps/talk.h =================================================================== RCS file: /cvsroot/rockbox/apps/talk.h,v retrieving revision 1.13 diff -u -r1.13 talk.h --- apps/talk.h 22 Jul 2006 17:23:05 -0000 1.13 +++ apps/talk.h 15 Aug 2006 17:07:31 -0000 @@ -58,6 +58,7 @@ extern const char* const file_thumbnail_ext; /* ".talk" for file voicing */ void talk_init(void); +bool talk_voice_required(void); /* returns true if voice codec required */ int talk_get_bufsize(void); /* get the loaded voice file size */ int talk_buffer_steal(void); /* claim the mp3 buffer e.g. for play/record */ int talk_id(long id, bool enqueue); /* play a voice ID from voicefont */ Index: apps/talk.c =================================================================== RCS file: /cvsroot/rockbox/apps/talk.c,v retrieving revision 1.47 diff -u -r1.47 talk.c --- apps/talk.c 1 Aug 2006 22:02:47 -0000 1.47 +++ apps/talk.c 15 Aug 2006 17:07:35 -0000 @@ -146,10 +146,6 @@ return open(buf, O_RDONLY); } -int talk_get_bufsize(void) -{ - return voicefile_size; -} /* load the voice file into the mp3 buffer */ static void load_voicefile(void) @@ -532,6 +528,19 @@ } } +/* return if a voice codec is required or not */ +bool talk_voice_required(void) +{ + return (voicefile_size != 0) + || (global_settings.talk_dir == 3) + || (global_settings.talk_file == 3); +} + +/* return size of voice file */ +int talk_get_bufsize(void) +{ + return voicefile_size; +} /* somebody else claims the mp3 buffer, e.g. for regular play/record */ int talk_buffer_steal(void)