Crossfade: added a new option, rewrote decision logic, updated manual and menus. Translators please note that updated translations may be required for some crossfade menu items!

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23605 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jeffrey Goode 2009-11-11 00:48:17 +00:00
parent 6db8f952dc
commit 664dc90e71
40 changed files with 241 additions and 242 deletions

View File

@ -2374,12 +2374,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -2387,7 +2387,7 @@
</dest>
<voice>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</voice>
</phrase>
<phrase>

View File

@ -4674,7 +4674,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
@ -8628,12 +8628,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none

View File

@ -1645,12 +1645,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1667,7 +1667,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -2692,12 +2692,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -9256,7 +9256,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -2691,12 +2691,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -2704,7 +2704,7 @@
</dest>
<voice>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</voice>
</phrase>
<phrase>
@ -9235,7 +9235,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
@ -9243,7 +9243,7 @@
</dest>
<voice>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</voice>
</phrase>
<phrase>

View File

@ -1651,12 +1651,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1673,7 +1673,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -7487,12 +7487,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -9516,7 +9516,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1668,12 +1668,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1690,7 +1690,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -2885,11 +2885,11 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: "Track Skip Only"
*: "Manual Track Skip Only"
</source>
<dest>
*: "Ainult raja vahele jätmisel"

View File

@ -1740,20 +1740,20 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</dest>
<voice>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</voice>
</phrase>
<phrase>
@ -1762,15 +1762,15 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</dest>
<voice>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</voice>
</phrase>
<phrase>
@ -13227,3 +13227,20 @@
morse_input: "Use Morse Code Input"
</voice>
</phrase>
<phrase>
id: LANG_AUTOTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Auto Track Skip Only"
</source>
<dest>
*: none
swcodec: "Auto Track Skip Only"
</dest>
<voice>
*: none
swcodec: "Auto Track Skip Only"
</voice>
</phrase>

View File

@ -7903,12 +7903,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -8911,7 +8911,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -2880,11 +2880,11 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: "Track Skip Only"
*: "Manual Track Skip Only"
</source>
<dest>
*: "Nur por transsalti kanton"

View File

@ -2692,12 +2692,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -9673,7 +9673,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1698,12 +1698,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1720,7 +1720,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1651,12 +1651,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1673,7 +1673,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1675,12 +1675,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1697,7 +1697,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1669,12 +1669,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1691,7 +1691,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1673,12 +1673,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1695,7 +1695,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -2703,12 +2703,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -9693,7 +9693,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1737,12 +1737,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1759,7 +1759,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1647,12 +1647,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1660,7 +1660,7 @@
</dest>
<voice>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</voice>
</phrase>
<phrase>
@ -1669,7 +1669,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
@ -1677,7 +1677,7 @@
</dest>
<voice>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</voice>
</phrase>
<phrase>

View File

@ -2693,12 +2693,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -9671,15 +9671,15 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</dest>
<voice>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</voice>
</phrase>
<phrase>

View File

@ -2641,12 +2641,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -9355,7 +9355,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -7502,12 +7502,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -8905,7 +8905,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1675,12 +1675,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1697,7 +1697,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1666,12 +1666,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1688,7 +1688,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -8224,7 +8224,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
@ -9569,12 +9569,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none

View File

@ -4930,7 +4930,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
@ -8782,12 +8782,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none

View File

@ -8761,7 +8761,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
@ -10294,12 +10294,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none

View File

@ -1650,12 +1650,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1672,7 +1672,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1672,12 +1672,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1694,7 +1694,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1649,12 +1649,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1662,7 +1662,7 @@
</dest>
<voice>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</voice>
</phrase>
<phrase>
@ -1671,7 +1671,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
@ -1679,7 +1679,7 @@
</dest>
<voice>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</voice>
</phrase>
<phrase>

View File

@ -1648,12 +1648,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1661,7 +1661,7 @@
</dest>
<voice>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</voice>
</phrase>
<phrase>
@ -1670,7 +1670,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none
@ -1678,7 +1678,7 @@
</dest>
<voice>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</voice>
</phrase>
<phrase>

View File

@ -1665,12 +1665,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1687,7 +1687,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -1672,12 +1672,12 @@
</voice>
</phrase>
<phrase>
id: LANG_TRACKSKIP
id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
<source>
*: none
swcodec: "Track Skip Only"
swcodec: "Manual Track Skip Only"
</source>
<dest>
*: none
@ -1694,7 +1694,7 @@
user: core
<source>
*: none
swcodec: "Shuffle and Track Skip"
swcodec: "Shuffle and Manual Track Skip"
</source>
<dest>
*: none

View File

@ -454,10 +454,6 @@ size_t pcmbuf_init(unsigned char *bufend)
init_pcmbuffers();
if(track_transition){logf("pcmbuf: (init) track transition false");}
end_of_track = false;
track_transition = false;
#ifdef HAVE_CROSSFADE
pcmbuf_finish_crossfade_enable();
#else
@ -472,112 +468,84 @@ size_t pcmbuf_init(unsigned char *bufend)
/* Track change */
/* The codec is moving on to the next track, but the current track is
* still playing. Set flags to make sure the elapsed time of the current
* track is updated properly, and mark the currently written chunk as the
* last one in the track. */
static void start_gapless_track_change(void)
{
logf(" gapless track change");
/* we're starting a track transition */
track_transition = true;
/* mark the last chunk in the track */
end_of_track = true;
}
#ifdef HAVE_CROSSFADE
static bool pcmbuf_is_crossfade_enabled(void)
{
if (global_settings.crossfade == CROSSFADE_ENABLE_SHUFFLE)
return global_settings.playlist_shuffle;
return crossfade_enabled;
}
#endif
static void start_processed_track_change(bool auto_skip)
{
logf(" processed track change");
/* Notify the wps that the track change starts now */
audio_post_track_change(false);
/* Can't do two crossfades at once and, no fade if pcm is off now */
if (
#ifdef HAVE_CROSSFADE
pcmbuf_is_crossfade_active() ||
#endif
!pcm_is_playing())
{
pcmbuf_play_stop();
return;
}
trigger_cpu_boost();
/* Not enough data, or crossfade disabled, flush the old data instead */
if (LOW_DATA(2) ||
#ifdef HAVE_CROSSFADE
!pcmbuf_is_crossfade_enabled() ||
#endif
low_latency_mode)
{
/* commit everything to this point and keep going, but... */
commit_chunk();
/* ... when the next chunk commits, throw away everything but itself */
flush_pcmbuf = true;
return;
}
#ifdef HAVE_CROSSFADE
/* Don't enable mix mode when skipping tracks manually. */
crossfade_mixmode = auto_skip && global_settings.crossfade_fade_out_mixmode;
crossfade_track_change_started = true;
#else
(void)auto_skip;
#endif
}
void pcmbuf_start_track_change(bool auto_skip)
{
bool process = false;
/* Manual track change (always crossfade or flush audio). */
if (!auto_skip)
process = true;
bool crossfade = false;
#ifdef HAVE_CROSSFADE
/* Automatic track change w/crossfade, if not in "Track Skip Only" mode. */
else if (pcmbuf_is_crossfade_enabled() && !pcmbuf_is_crossfade_active()
&& global_settings.crossfade != CROSSFADE_ENABLE_TRACKSKIP)
/* Determine whether this track change needs to crossfade */
if(crossfade_enabled && !pcmbuf_is_crossfade_active())
{
if (global_settings.crossfade == CROSSFADE_ENABLE_SHUFFLE_AND_TRACKSKIP)
switch(global_settings.crossfade)
{
if (global_settings.playlist_shuffle)
process = true;
case CROSSFADE_ENABLE_AUTOSKIP:
crossfade = auto_skip;
break;
case CROSSFADE_ENABLE_MANSKIP:
crossfade = !auto_skip;
break;
case CROSSFADE_ENABLE_SHUFFLE:
crossfade = global_settings.playlist_shuffle;
break;
case CROSSFADE_ENABLE_SHUFFLE_AND_MANSKIP:
crossfade = global_settings.playlist_shuffle && !auto_skip;
break;
case CROSSFADE_ENABLE_ALWAYS:
crossfade = true;
break;
}
else
process = true;
}
#endif
if (process)
/* process track change (manual skip or crossfade) */
start_processed_track_change(auto_skip);
else
/* normal gapless playback */
start_gapless_track_change();
}
if (!auto_skip || crossfade)
/* manual skip or crossfade */
{
if (crossfade)
{ logf(" crossfade track change"); }
else
{ logf(" manual track change"); }
/* Notify the wps that the track change starts now */
audio_post_track_change(false);
/* Called when the last chunk in the track has been played */
static void finish_gapless_track_change(void)
{
/* not in a track transition anymore */
if(track_transition){logf("pcmbuf: (finish change) track transition false");}
track_transition = false;
/* notify playback that the track has just finished */
audio_post_track_change(true);
/* Can't do two crossfades at once and, no fade if pcm is off now */
if (
#ifdef HAVE_CROSSFADE
pcmbuf_is_crossfade_active() ||
#endif
!pcm_is_playing())
{
pcmbuf_play_stop();
return;
}
trigger_cpu_boost();
/* Not enough data, or not crossfading, flush the old data instead */
if (LOW_DATA(2) || !crossfade || low_latency_mode)
{
flush_pcmbuf = true;
commit_chunk();
return;
}
#ifdef HAVE_CROSSFADE
/* Don't enable mix mode when skipping tracks manually. */
crossfade_mixmode = auto_skip && global_settings.crossfade_fade_out_mixmode;
crossfade_track_change_started = crossfade;
#endif
}
else /* automatic and not crossfading, so gapless track change */
{
/* The codec is moving on to the next track, but the current track will
* continue to play. Set a flag to make sure the elapsed time of the
* current track will be updated properly, and mark the current chunk
* as the last one in the track. */
logf(" gapless track change");
track_transition = true;
end_of_track = true;
}
}
@ -586,28 +554,31 @@ static void finish_gapless_track_change(void)
/** PCM driver callback
* This function has 3 major logical parts (separated by brackets both for
* readability and variable scoping). The first part performs the
* operations related to finishing off the last buffer we fed to the DMA.
* The second part detects the end of playlist condition when the pcm
* buffer is empty except for uncommitted samples. Then they are committed.
* The third part performs the operations involved in sending a new buffer
* to the DMA. */
* operations related to finishing off the last chunk we fed to the DMA.
* The second part detects the end of playlist condition when the PCM
* buffer is empty except for uncommitted samples. Then they are committed
* and sent to the PCM driver for playback. The third part performs the
* operations involved in sending a new chunk to the DMA. */
static void pcmbuf_pcm_callback(unsigned char** start, size_t* size) ICODE_ATTR;
static void pcmbuf_pcm_callback(unsigned char** start, size_t* size)
{
{
struct chunkdesc *pcmbuf_current = read_chunk;
/* Take the finished buffer out of circulation */
/* Take the finished chunk out of circulation */
read_chunk = pcmbuf_current->link;
/* if during a track transition, update the elapsed time */
if (track_transition)
audio_pcmbuf_position_callback(last_chunksize);
/* if last buffer in the track, let the audio thread know */
/* if last chunk in the track, stop updates and notify audio thread */
if (pcmbuf_current->end_of_track)
finish_gapless_track_change();
{
track_transition = false;
audio_post_track_change(true);
}
/* Put the finished buffer back into circulation */
/* Put the finished chunk back into circulation */
write_end_chunk->link = pcmbuf_current;
write_end_chunk = pcmbuf_current;
@ -632,7 +603,7 @@ static void pcmbuf_pcm_callback(unsigned char** start, size_t* size)
}
{
/* Send the new buffer to the pcm */
/* Send the new chunk to the PCM */
if(read_chunk)
{
size_t current_size = read_chunk->size;
@ -644,12 +615,11 @@ static void pcmbuf_pcm_callback(unsigned char** start, size_t* size)
}
else
{
/* No more buffers */
/* No more chunks */
logf("pcmbuf_pcm_callback: no more chunks");
last_chunksize = 0;
*size = 0;
*start = NULL;
if (end_of_track)
finish_gapless_track_change();
}
}
DISPLAY_DESC("callback");
@ -660,6 +630,7 @@ void pcmbuf_play_start(void)
{
if (!pcm_is_playing() && pcmbuf_unplayed_bytes && read_chunk != NULL)
{
logf("pcmbuf_play_start");
last_chunksize = read_chunk->size;
pcmbuf_unplayed_bytes -= last_chunksize;
pcm_play_data(pcmbuf_pcm_callback,
@ -669,6 +640,7 @@ void pcmbuf_play_start(void)
void pcmbuf_play_stop(void)
{
logf("pcmbuf_play_stop");
pcm_play_stop();
pcmbuf_unplayed_bytes = 0;
@ -684,6 +656,8 @@ void pcmbuf_play_stop(void)
crossfade_track_change_started = false;
crossfade_active = false;
#endif
end_of_track = false;
track_transition = false;
flush_pcmbuf = false;
DISPLAY_DESC("play_stop");
@ -693,6 +667,7 @@ void pcmbuf_play_stop(void)
void pcmbuf_pause(bool pause)
{
logf("pcmbuf_pause: %s", pause?"pause":"play");
if (pcm_is_playing())
pcm_play_pause(!pause);
else if (!pause)

View File

@ -236,7 +236,7 @@ void audio_pcmbuf_position_callback(size_t size)
if (time >= othertrack_id3->length)
{
if(track_transition){logf("playback: (callback) track transition false");}
/* we just played the end of the track, so stop this callback */
track_transition = false;
othertrack_id3->elapsed = othertrack_id3->length;
}

View File

@ -109,13 +109,16 @@ enum
TRIG_TYPE_NEW_FILE
};
#ifdef HAVE_CROSSFADE
enum {
CROSSFADE_ENABLE_OFF = 0,
CROSSFADE_ENABLE_AUTOSKIP,
CROSSFADE_ENABLE_MANSKIP,
CROSSFADE_ENABLE_SHUFFLE,
CROSSFADE_ENABLE_TRACKSKIP,
CROSSFADE_ENABLE_SHUFFLE_AND_TRACKSKIP,
CROSSFADE_ENABLE_SHUFFLE_AND_MANSKIP,
CROSSFADE_ENABLE_ALWAYS,
};
#endif
enum {
FOLDER_ADVANCE_OFF = 0,

View File

@ -1166,8 +1166,9 @@ const struct settings_list settings[] = {
/* crossfade */
CHOICE_SETTING(F_SOUNDSETTING, crossfade, LANG_CROSSFADE_ENABLE, 0,
"crossfade",
"off,shuffle,track skip,shuffle and track skip,always", NULL,
5, ID2P(LANG_OFF), ID2P(LANG_SHUFFLE), ID2P(LANG_TRACKSKIP),
"off,auto track skip,man track skip,shuffle,shuffle and man track skip,always",
NULL, 6, ID2P(LANG_OFF), ID2P(LANG_AUTOTRACKSKIP),
ID2P(LANG_MANTRACKSKIP), ID2P(LANG_SHUFFLE),
ID2P(LANG_SHUFFLE_TRACKSKIP), ID2P(LANG_ALWAYS)),
INT_SETTING(F_SOUNDSETTING, crossfade_fade_in_delay,
LANG_CROSSFADE_FADE_IN_DELAY, 0,

View File

@ -106,13 +106,16 @@ you to configure settings related to audio playback.
Options for crossfade settings are:
\begin{description}
\item[Enable Crossfade.] If set to \setting{Off}, crossfade is disabled.
If set to \setting{Shuffle}, crossfade is enabled when the
shuffle feature is set to \setting{Yes}, but disabled otherwise. If set
to \setting{Track Skip Only}, tracks will only crossfade when manually
skipped. If set to \setting{Shuffle and Track Skip}
then crossfade will only be active when shuffle is set to
\setting{Yes} and the track is manually skipped. If set to
\setting{Always}, tracks will always crossfade into one another.
If set to \setting{Auto Track Skip Only}, crossfade occurs for
automatic skips, but not for manual skips. The next setting,
\setting{Manual Track Skip Only}, is the opposite: tracks will only
crossfade when manually skipped. If set to \setting{Shuffle}, crossfade
is enabled for all track changes when the shuffle feature is set to
\setting{Yes}, but disabled otherwise. If set to
\setting{Shuffle and Manual Track Skip} then crossfade will only be
active when shuffle is set to \setting{Yes} and the track is then
manually skipped. If set to \setting{Always}, tracks will always
crossfade into one another.
%
\item[Fade In Delay.] The ``fade in delay'' is the length of time between
when the crossfade process begins and when the new track begins to fade