From b770d53cb41370acf6e36486877f1fb9931c97ef Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Wed, 28 Dec 2005 21:13:52 +0000 Subject: [PATCH] Fixed the crossfade and track skipping glitches. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8292 a1c6a512-1295-4272-9138-f99709370657 --- apps/pcmbuf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 4277dca379..f1988fd3f4 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -353,7 +353,7 @@ static void crossfade_process_buffer( /* Prevent pcmbuffer from wrapping. */ if (pos >= pcmbuf_size) pos -= pcmbuf_size; - blocksize = MIN(pcmbuf_size - pos, blocksize); + blocksize = MIN((pcmbuf_size - pos)/2, blocksize); buf = (short *)&audiobuffer[pos]; fade_out_rem -= blocksize; @@ -413,14 +413,14 @@ static void crossfade_start(void) fade_out_rem = NATIVE_FREQUENCY * global_settings.crossfade_fade_out_duration * 2; - /* Truncate fade out duration if necessary. */ - if (fade_out_rem > crossfade_rem) - fade_out_rem = crossfade_rem; - /* We want only to modify the last part of the buffer. */ if (crossfade_rem > fade_out_rem + fade_out_delay) crossfade_rem = fade_out_rem + fade_out_delay; + /* Truncate fade out duration if necessary. */ + if (crossfade_rem < fade_out_rem + fade_out_delay) + fade_out_rem -= (fade_out_rem + fade_out_delay) - crossfade_rem; + /* Get also fade in duration and delays from settings. */ crossfade_fade_in_rem = NATIVE_FREQUENCY * global_settings.crossfade_fade_in_duration * 2;