summaryrefslogtreecommitdiffstats
path: root/apps/pcmbuf.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-07-09 01:49:00 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-07-09 01:49:00 +0000
commita802ebac060159015b91e266e5bff5ce7ec7918a (patch)
treecfa85abcacc8d9ea505e928a34565532707ceebf /apps/pcmbuf.c
parentd8cb05e31ea896e4b8272b2e931f5f927294cc34 (diff)
downloadrockbox-a802ebac060159015b91e266e5bff5ce7ec7918a.tar.gz
rockbox-a802ebac060159015b91e266e5bff5ce7ec7918a.tar.bz2
rockbox-a802ebac060159015b91e266e5bff5ce7ec7918a.zip
The voice PCM buffer has nothing to do with the playback PCM buffer any longer. Allocate it independently from the playback engine's PCM buffer and only when voice is required. Additionally, allocate actual space for the crossfade buffer only when using crossfade. Will save 18.3KB when neither is needed (10.3KB for voice and 8.0KB for crossfade).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30133 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/pcmbuf.c')
-rw-r--r--apps/pcmbuf.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index ca17437534..946eb16021 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -467,22 +467,20 @@ static size_t get_next_required_pcmbuf_size(void)
}
/* Initialize the pcmbuffer the structure looks like this:
- * ...|---------PCMBUF---------|FADEBUF|VOICEBUF|DESCS|... */
+ * ...|---------PCMBUF---------[|FADEBUF]|DESCS|... */
size_t pcmbuf_init(unsigned char *bufend)
{
- unsigned char *voicebuf;
-
pcmbuf_bufend = bufend;
pcmbuf_size = get_next_required_pcmbuf_size();
write_chunk = (struct chunkdesc *)pcmbuf_bufend -
NUM_CHUNK_DESCS(pcmbuf_size);
- voicebuf = (unsigned char *)write_chunk -
- voicebuf_init((unsigned char *)write_chunk);
+
#ifdef HAVE_CROSSFADE
- fadebuf = voicebuf - CROSSFADE_BUFSIZE;
+ fadebuf = (unsigned char *)write_chunk -
+ (crossfade_enable_request ? CROSSFADE_BUFSIZE : 0);
pcmbuffer = fadebuf - pcmbuf_size;
#else
- pcmbuffer = voicebuf - pcmbuf_size;
+ pcmbuffer = (unsigned char *)write_chunk - pcmbuf_size;
#endif
init_pcmbuffers();