From a4f8d1c621ee1ad1e9649e2e84dddac3108d73b6 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Fri, 27 Jan 2006 16:25:44 +0000 Subject: [PATCH] Don't use crossfader mix mode when skipping tracks manually. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8470 a1c6a512-1295-4272-9138-f99709370657 --- apps/pcmbuf.c | 10 +++++++--- apps/pcmbuf.h | 2 +- apps/playback.c | 12 ++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index e21f735bbb..f184672bd1 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -233,7 +233,7 @@ bool pcmbuf_is_lowdata(void) return false; } -bool pcmbuf_crossfade_init(void) +bool pcmbuf_crossfade_init(bool manual_skip) { if (pcmbuf_size - audiobuffer_free < CHUNK_SIZE * 8 || !pcmbuf_is_crossfade_enabled() @@ -244,8 +244,12 @@ bool pcmbuf_crossfade_init(void) logf("pcmbuf_crossfade_init"); pcmbuf_boost(true); - crossfade_mode = global_settings.crossfade_fade_out_mixmode - ? CFM_MIX : CFM_CROSSFADE; + /* Don't enable mix mode when skipping tracks manually. */ + if (manual_skip) + crossfade_mode = CFM_CROSSFADE; + else + crossfade_mode = global_settings.crossfade_fade_out_mixmode + ? CFM_MIX : CFM_CROSSFADE; crossfade_init = true; return true; diff --git a/apps/pcmbuf.h b/apps/pcmbuf.h index 7e7ecf1d75..afc62021aa 100644 --- a/apps/pcmbuf.h +++ b/apps/pcmbuf.h @@ -41,7 +41,7 @@ void pcmbuf_set_boost_mode(bool state); bool pcmbuf_is_lowdata(void); void pcmbuf_flush_audio(void); void pcmbuf_play_start(void); -bool pcmbuf_crossfade_init(void); +bool pcmbuf_crossfade_init(bool manual_skip); void pcmbuf_add_event(void (*event_handler)(void)); void pcmbuf_set_position_callback(void (*callback)(int size)); unsigned int pcmbuf_get_latency(void); diff --git a/apps/playback.c b/apps/playback.c index c535e30c8a..3eda695b39 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -1510,14 +1510,14 @@ static void audio_update_trackinfo(void) /* Manual track change (always crossfade or flush audio). */ if (new_track) { - pcmbuf_crossfade_init(); + pcmbuf_crossfade_init(true); codec_track_changed(); } /* Automatic track change with crossfade. */ else if (pcmbuf_is_crossfade_enabled() && !pcmbuf_is_crossfade_active()) { - pcmbuf_crossfade_init(); + pcmbuf_crossfade_init(false); codec_track_changed(); } @@ -1574,7 +1574,7 @@ static int skip_next_track(bool inside_codec_thread) stop_codec_flush(); } else if (pcmbuf_is_crossfade_enabled()) - pcmbuf_crossfade_init(); + pcmbuf_crossfade_init(new_track != 0); queue_post(&audio_queue, Q_AUDIO_PLAY, 0); return SKIP_OK_DISK; @@ -1611,7 +1611,7 @@ static int skip_previous_track(bool inside_codec_thread) /* Stop playback. */ /* FIXME: Only stop playback if disk is not spinning! */ if (pcmbuf_is_crossfade_enabled()) - pcmbuf_crossfade_init(); + pcmbuf_crossfade_init(true); else if (inside_codec_thread) pcmbuf_play_stop(); else @@ -1747,7 +1747,7 @@ static void initiate_track_change(int peek_index) /* Detect if disk is spinning or already loading. */ if (filling || ci.reload_codec || !audio_codec_loaded) { if (pcmbuf_is_crossfade_enabled()) - pcmbuf_crossfade_init(); + pcmbuf_crossfade_init(true); else pcmbuf_play_stop(); ci.stop_codec = true; @@ -2158,7 +2158,7 @@ void audio_play(int offset) { ci.stop_codec = true; sleep(1); - pcmbuf_crossfade_init(); + pcmbuf_crossfade_init(true); } else {