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
This commit is contained in:
Miika Pekkarinen 2006-01-27 16:25:44 +00:00
parent b7c29193f9
commit a4f8d1c621
3 changed files with 14 additions and 10 deletions

View file

@ -233,7 +233,7 @@ bool pcmbuf_is_lowdata(void)
return false; return false;
} }
bool pcmbuf_crossfade_init(void) bool pcmbuf_crossfade_init(bool manual_skip)
{ {
if (pcmbuf_size - audiobuffer_free < CHUNK_SIZE * 8 if (pcmbuf_size - audiobuffer_free < CHUNK_SIZE * 8
|| !pcmbuf_is_crossfade_enabled() || !pcmbuf_is_crossfade_enabled()
@ -244,8 +244,12 @@ bool pcmbuf_crossfade_init(void)
logf("pcmbuf_crossfade_init"); logf("pcmbuf_crossfade_init");
pcmbuf_boost(true); pcmbuf_boost(true);
crossfade_mode = global_settings.crossfade_fade_out_mixmode /* Don't enable mix mode when skipping tracks manually. */
? CFM_MIX : CFM_CROSSFADE; if (manual_skip)
crossfade_mode = CFM_CROSSFADE;
else
crossfade_mode = global_settings.crossfade_fade_out_mixmode
? CFM_MIX : CFM_CROSSFADE;
crossfade_init = true; crossfade_init = true;
return true; return true;

View file

@ -41,7 +41,7 @@ void pcmbuf_set_boost_mode(bool state);
bool pcmbuf_is_lowdata(void); bool pcmbuf_is_lowdata(void);
void pcmbuf_flush_audio(void); void pcmbuf_flush_audio(void);
void pcmbuf_play_start(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_add_event(void (*event_handler)(void));
void pcmbuf_set_position_callback(void (*callback)(int size)); void pcmbuf_set_position_callback(void (*callback)(int size));
unsigned int pcmbuf_get_latency(void); unsigned int pcmbuf_get_latency(void);

View file

@ -1510,14 +1510,14 @@ static void audio_update_trackinfo(void)
/* Manual track change (always crossfade or flush audio). */ /* Manual track change (always crossfade or flush audio). */
if (new_track) if (new_track)
{ {
pcmbuf_crossfade_init(); pcmbuf_crossfade_init(true);
codec_track_changed(); codec_track_changed();
} }
/* Automatic track change with crossfade. */ /* Automatic track change with crossfade. */
else if (pcmbuf_is_crossfade_enabled() && !pcmbuf_is_crossfade_active()) else if (pcmbuf_is_crossfade_enabled() && !pcmbuf_is_crossfade_active())
{ {
pcmbuf_crossfade_init(); pcmbuf_crossfade_init(false);
codec_track_changed(); codec_track_changed();
} }
@ -1574,7 +1574,7 @@ static int skip_next_track(bool inside_codec_thread)
stop_codec_flush(); stop_codec_flush();
} }
else if (pcmbuf_is_crossfade_enabled()) else if (pcmbuf_is_crossfade_enabled())
pcmbuf_crossfade_init(); pcmbuf_crossfade_init(new_track != 0);
queue_post(&audio_queue, Q_AUDIO_PLAY, 0); queue_post(&audio_queue, Q_AUDIO_PLAY, 0);
return SKIP_OK_DISK; return SKIP_OK_DISK;
@ -1611,7 +1611,7 @@ static int skip_previous_track(bool inside_codec_thread)
/* Stop playback. */ /* Stop playback. */
/* FIXME: Only stop playback if disk is not spinning! */ /* FIXME: Only stop playback if disk is not spinning! */
if (pcmbuf_is_crossfade_enabled()) if (pcmbuf_is_crossfade_enabled())
pcmbuf_crossfade_init(); pcmbuf_crossfade_init(true);
else if (inside_codec_thread) else if (inside_codec_thread)
pcmbuf_play_stop(); pcmbuf_play_stop();
else else
@ -1747,7 +1747,7 @@ static void initiate_track_change(int peek_index)
/* Detect if disk is spinning or already loading. */ /* Detect if disk is spinning or already loading. */
if (filling || ci.reload_codec || !audio_codec_loaded) { if (filling || ci.reload_codec || !audio_codec_loaded) {
if (pcmbuf_is_crossfade_enabled()) if (pcmbuf_is_crossfade_enabled())
pcmbuf_crossfade_init(); pcmbuf_crossfade_init(true);
else else
pcmbuf_play_stop(); pcmbuf_play_stop();
ci.stop_codec = true; ci.stop_codec = true;
@ -2158,7 +2158,7 @@ void audio_play(int offset)
{ {
ci.stop_codec = true; ci.stop_codec = true;
sleep(1); sleep(1);
pcmbuf_crossfade_init(); pcmbuf_crossfade_init(true);
} }
else else
{ {