summaryrefslogtreecommitdiffstats
path: root/apps/pcmbuf.c
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2009-08-11 02:05:38 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2009-08-11 02:05:38 +0000
commit6469926b889f1533134233c63c894ac471f2f53c (patch)
treeb1d0cfce47546917e49dbf4607216770f5bda721 /apps/pcmbuf.c
parent47a090105adac2c7d63165a28f46126df08ce494 (diff)
downloadrockbox-6469926b889f1533134233c63c894ac471f2f53c.tar.gz
rockbox-6469926b889f1533134233c63c894ac471f2f53c.tar.bz2
rockbox-6469926b889f1533134233c63c894ac471f2f53c.zip
FS#10506. Don't compile various crossfade only functions in pcmbuf.c on low memory targets (mainly AMS) to save memory. Some crossfade related items remain in the code, but they're not worth cluttering the code with ifdefs over. Also, introduce HAVE_CROSSFADE define for neatness.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22248 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/pcmbuf.c')
-rw-r--r--apps/pcmbuf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index b8d8a0c8d0..e23f6d0fb6 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -91,11 +91,13 @@ static bool crossfade_init IDATA_ATTR;
/* Track the current location for processing crossfade */
static struct pcmbufdesc *crossfade_chunk IDATA_ATTR;
+#ifdef HAVE_CROSSFADE
static size_t crossfade_sample IDATA_ATTR;
/* Counters for fading in new data */
static size_t crossfade_fade_in_total IDATA_ATTR;
static size_t crossfade_fade_in_rem IDATA_ATTR;
+#endif
static struct pcmbufdesc *pcmbuf_read IDATA_ATTR;
static struct pcmbufdesc *pcmbuf_read_end IDATA_ATTR;
@@ -543,6 +545,11 @@ static bool pcmbuf_flush_fillpos(void)
return false;
}
+/**
+ * Low memory targets don't have crossfade, so don't compile crossfade
+ * specific code in order to save some memory. */
+
+#ifdef HAVE_CROSSFADE
/**
* Completely process the crossfade fade out effect with current pcm buffer.
*/
@@ -824,6 +831,7 @@ fade_done:
}
}
+#endif
static bool prepare_insert(size_t length)
{
@@ -862,8 +870,10 @@ static bool prepare_insert(size_t length)
void* pcmbuf_request_buffer(int *count)
{
+#ifdef HAVE_CROSSFADE
if (crossfade_init)
crossfade_start();
+#endif
if (crossfade_active) {
*count = MIN(*count, PCMBUF_MIX_CHUNK/4);
@@ -929,7 +939,7 @@ bool pcmbuf_is_crossfade_active(void)
void pcmbuf_write_complete(int count)
{
size_t length = (size_t)(unsigned int)count << 2;
-
+#ifdef HAVE_CROSSFADE
if (crossfade_active)
{
flush_crossfade(fadebuf, length);
@@ -937,6 +947,7 @@ void pcmbuf_write_complete(int count)
crossfade_active = false;
}
else
+#endif
{
audiobuffer_fillpos += length;