summaryrefslogtreecommitdiff
path: root/apps/pcmbuf.c
diff options
context:
space:
mode:
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;
91 91
92/* Track the current location for processing crossfade */ 92/* Track the current location for processing crossfade */
93static struct pcmbufdesc *crossfade_chunk IDATA_ATTR; 93static struct pcmbufdesc *crossfade_chunk IDATA_ATTR;
94#ifdef HAVE_CROSSFADE
94static size_t crossfade_sample IDATA_ATTR; 95static size_t crossfade_sample IDATA_ATTR;
95 96
96/* Counters for fading in new data */ 97/* Counters for fading in new data */
97static size_t crossfade_fade_in_total IDATA_ATTR; 98static size_t crossfade_fade_in_total IDATA_ATTR;
98static size_t crossfade_fade_in_rem IDATA_ATTR; 99static size_t crossfade_fade_in_rem IDATA_ATTR;
100#endif
99 101
100static struct pcmbufdesc *pcmbuf_read IDATA_ATTR; 102static struct pcmbufdesc *pcmbuf_read IDATA_ATTR;
101static struct pcmbufdesc *pcmbuf_read_end IDATA_ATTR; 103static struct pcmbufdesc *pcmbuf_read_end IDATA_ATTR;
@@ -543,6 +545,11 @@ static bool pcmbuf_flush_fillpos(void)
543 return false; 545 return false;
544} 546}
545 547
548/**
549 * Low memory targets don't have crossfade, so don't compile crossfade
550 * specific code in order to save some memory. */
551
552#ifdef HAVE_CROSSFADE
546/** 553/**
547 * Completely process the crossfade fade out effect with current pcm buffer. 554 * Completely process the crossfade fade out effect with current pcm buffer.
548 */ 555 */
@@ -824,6 +831,7 @@ fade_done:
824 } 831 }
825 832
826} 833}
834#endif
827 835
828static bool prepare_insert(size_t length) 836static bool prepare_insert(size_t length)
829{ 837{
@@ -862,8 +870,10 @@ static bool prepare_insert(size_t length)
862 870
863void* pcmbuf_request_buffer(int *count) 871void* pcmbuf_request_buffer(int *count)
864{ 872{
873#ifdef HAVE_CROSSFADE
865 if (crossfade_init) 874 if (crossfade_init)
866 crossfade_start(); 875 crossfade_start();
876#endif
867 877
868 if (crossfade_active) { 878 if (crossfade_active) {
869 *count = MIN(*count, PCMBUF_MIX_CHUNK/4); 879 *count = MIN(*count, PCMBUF_MIX_CHUNK/4);
@@ -929,7 +939,7 @@ bool pcmbuf_is_crossfade_active(void)
929void pcmbuf_write_complete(int count) 939void pcmbuf_write_complete(int count)
930{ 940{
931 size_t length = (size_t)(unsigned int)count << 2; 941 size_t length = (size_t)(unsigned int)count << 2;
932 942#ifdef HAVE_CROSSFADE
933 if (crossfade_active) 943 if (crossfade_active)
934 { 944 {
935 flush_crossfade(fadebuf, length); 945 flush_crossfade(fadebuf, length);
@@ -937,6 +947,7 @@ void pcmbuf_write_complete(int count)
937 crossfade_active = false; 947 crossfade_active = false;
938 } 948 }
939 else 949 else
950#endif
940 { 951 {
941 audiobuffer_fillpos += length; 952 audiobuffer_fillpos += length;
942 953