summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/pcmbuf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index 22e725507b..57058a3e95 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -233,8 +233,9 @@ bool pcmbuf_is_lowdata(void)
233{ 233{
234 if (!pcm_is_playing() || pcm_is_paused() || crossfade_init || crossfade_active) 234 if (!pcm_is_playing() || pcm_is_paused() || crossfade_init || crossfade_active)
235 return false; 235 return false;
236 236
237 if (pcmbuf_unplayed_bytes < pcmbuf_watermark - CHUNK_SIZE) 237 /* 0.5s. */
238 if (pcmbuf_unplayed_bytes < NATIVE_FREQUENCY * 4 / 2)
238 return true; 239 return true;
239 240
240 return false; 241 return false;
@@ -429,7 +430,7 @@ static void crossfade_start(void)
429 int fade_in_delay = 0; 430 int fade_in_delay = 0;
430 431
431 crossfade_init = 0; 432 crossfade_init = 0;
432 if (bytesleft < NATIVE_FREQUENCY * 4 / 2) { 433 if (bytesleft < CHUNK_SIZE * 4) {
433 logf("crossfade rejected"); 434 logf("crossfade rejected");
434 pcmbuf_play_stop(); 435 pcmbuf_play_stop();
435 return ; 436 return ;
@@ -446,7 +447,8 @@ static void crossfade_start(void)
446 case CFM_MIX: 447 case CFM_MIX:
447 case CFM_CROSSFADE: 448 case CFM_CROSSFADE:
448 /* Initialize the crossfade buffer size. */ 449 /* Initialize the crossfade buffer size. */
449 crossfade_rem = (bytesleft - (NATIVE_FREQUENCY / 4))/2; 450 // FIXME: Crashes unless we use CHUNK_SIZE here
451 crossfade_rem = (bytesleft - (CHUNK_SIZE * 2))/2;
450 452
451 /* Get fade out delay from settings. */ 453 /* Get fade out delay from settings. */
452 fade_out_delay = NATIVE_FREQUENCY 454 fade_out_delay = NATIVE_FREQUENCY