diff --git a/apps/lang/arabic.lang b/apps/lang/arabic.lang
index aed5e135f2..cc4bd5453b 100644
--- a/apps/lang/arabic.lang
+++ b/apps/lang/arabic.lang
@@ -2374,12 +2374,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -2387,7 +2387,7 @@
*: none
- swcodec: "Track Skip Only"
+ swcodec: "Manual Track Skip Only"
diff --git a/apps/lang/bulgarian.lang b/apps/lang/bulgarian.lang
index 7218735aa9..97a77448e7 100644
--- a/apps/lang/bulgarian.lang
+++ b/apps/lang/bulgarian.lang
@@ -4674,7 +4674,7 @@
user: core
*: none
@@ -8628,12 +8628,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
diff --git a/apps/lang/catala.lang b/apps/lang/catala.lang
index 96eb8983fd..f98fdc9a5a 100644
--- a/apps/lang/catala.lang
+++ b/apps/lang/catala.lang
@@ -1645,12 +1645,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1667,7 +1667,7 @@
user: core
*: none
diff --git a/apps/lang/chinese-simp.lang b/apps/lang/chinese-simp.lang
index 724be65290..bd6fb70809 100644
--- a/apps/lang/chinese-simp.lang
+++ b/apps/lang/chinese-simp.lang
@@ -2692,12 +2692,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -9256,7 +9256,7 @@
user: core
*: none
diff --git a/apps/lang/chinese-trad.lang b/apps/lang/chinese-trad.lang
index 7cde4cd93b..711f9bb173 100644
--- a/apps/lang/chinese-trad.lang
+++ b/apps/lang/chinese-trad.lang
@@ -2691,12 +2691,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -2704,7 +2704,7 @@
*: none
- swcodec: "Track Skip Only"
+ swcodec: "Manual Track Skip Only"
@@ -9235,7 +9235,7 @@
user: core
*: none
@@ -9243,7 +9243,7 @@
*: none
- swcodec: "Shuffle and Track Skip"
+ swcodec: "Shuffle and Manual Track Skip"
diff --git a/apps/lang/czech.lang b/apps/lang/czech.lang
index 7b6e19489d..4b10fa0622 100644
--- a/apps/lang/czech.lang
+++ b/apps/lang/czech.lang
@@ -1651,12 +1651,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1673,7 +1673,7 @@
user: core
*: none
diff --git a/apps/lang/dansk.lang b/apps/lang/dansk.lang
index 8a5196de42..22fb994013 100644
--- a/apps/lang/dansk.lang
+++ b/apps/lang/dansk.lang
@@ -7487,12 +7487,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -9516,7 +9516,7 @@
user: core
*: none
diff --git a/apps/lang/deutsch.lang b/apps/lang/deutsch.lang
index 6da7318100..631b2a0e82 100644
--- a/apps/lang/deutsch.lang
+++ b/apps/lang/deutsch.lang
@@ -1668,12 +1668,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1690,7 +1690,7 @@
user: core
*: none
diff --git a/apps/lang/eesti.lang b/apps/lang/eesti.lang
index b5402db925..23676b9e0d 100644
--- a/apps/lang/eesti.lang
+++ b/apps/lang/eesti.lang
@@ -2885,11 +2885,11 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: "Ainult raja vahele jätmisel"
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 198a3c7358..4fe1a1fa6c 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -1740,20 +1740,20 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
- swcodec: "Track Skip Only"
+ swcodec: "Manual Track Skip Only"
*: none
- swcodec: "Track Skip Only"
+ swcodec: "Manual Track Skip Only"
@@ -1762,15 +1762,15 @@
user: core
*: none
- swcodec: "Shuffle and Track Skip"
+ swcodec: "Shuffle and Manual Track Skip"
*: none
- swcodec: "Shuffle and Track Skip"
+ swcodec: "Shuffle and Manual Track Skip"
@@ -13227,3 +13227,20 @@
morse_input: "Use Morse Code Input"
+
+ id: LANG_AUTOTRACKSKIP
+ desc: in crossfade settings
+ user: core
+
+
+ *: none
+ swcodec: "Auto Track Skip Only"
+
+
+ *: none
+ swcodec: "Auto Track Skip Only"
+
+
diff --git a/apps/lang/espanol.lang b/apps/lang/espanol.lang
index cb88048ec1..bccbe7111f 100644
--- a/apps/lang/espanol.lang
+++ b/apps/lang/espanol.lang
@@ -7903,12 +7903,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -8911,7 +8911,7 @@
user: core
*: none
diff --git a/apps/lang/esperanto.lang b/apps/lang/esperanto.lang
index 616830eb7f..e3c1a21029 100644
--- a/apps/lang/esperanto.lang
+++ b/apps/lang/esperanto.lang
@@ -2880,11 +2880,11 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: "Nur por transsalti kanton"
diff --git a/apps/lang/finnish.lang b/apps/lang/finnish.lang
index 162fe266b3..efab8d2c69 100644
--- a/apps/lang/finnish.lang
+++ b/apps/lang/finnish.lang
@@ -2692,12 +2692,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -9673,7 +9673,7 @@
user: core
*: none
diff --git a/apps/lang/francais.lang b/apps/lang/francais.lang
index 28179dae2b..e898609604 100644
--- a/apps/lang/francais.lang
+++ b/apps/lang/francais.lang
@@ -1698,12 +1698,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1720,7 +1720,7 @@
user: core
*: none
diff --git a/apps/lang/greek.lang b/apps/lang/greek.lang
index 76384d22a4..50433b06b0 100644
--- a/apps/lang/greek.lang
+++ b/apps/lang/greek.lang
@@ -1651,12 +1651,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1673,7 +1673,7 @@
user: core
*: none
diff --git a/apps/lang/hebrew.lang b/apps/lang/hebrew.lang
index b837834c4f..dbf83fc943 100644
--- a/apps/lang/hebrew.lang
+++ b/apps/lang/hebrew.lang
@@ -1675,12 +1675,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1697,7 +1697,7 @@
user: core
*: none
diff --git a/apps/lang/italiano.lang b/apps/lang/italiano.lang
index c0717b2756..0685199fdc 100644
--- a/apps/lang/italiano.lang
+++ b/apps/lang/italiano.lang
@@ -1669,12 +1669,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1691,7 +1691,7 @@
user: core
*: none
diff --git a/apps/lang/japanese.lang b/apps/lang/japanese.lang
index 901871cceb..d281faafcf 100644
--- a/apps/lang/japanese.lang
+++ b/apps/lang/japanese.lang
@@ -1673,12 +1673,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1695,7 +1695,7 @@
user: core
*: none
diff --git a/apps/lang/korean.lang b/apps/lang/korean.lang
index 587d6aea53..adbb2c95cc 100644
--- a/apps/lang/korean.lang
+++ b/apps/lang/korean.lang
@@ -2703,12 +2703,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -9693,7 +9693,7 @@
user: core
*: none
diff --git a/apps/lang/lietuviu.lang b/apps/lang/lietuviu.lang
index 960944f556..d5a862879a 100644
--- a/apps/lang/lietuviu.lang
+++ b/apps/lang/lietuviu.lang
@@ -1737,12 +1737,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1759,7 +1759,7 @@
user: core
*: none
diff --git a/apps/lang/magyar.lang b/apps/lang/magyar.lang
index 038d7e572b..95fd901176 100644
--- a/apps/lang/magyar.lang
+++ b/apps/lang/magyar.lang
@@ -1647,12 +1647,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1660,7 +1660,7 @@
*: none
- swcodec: "Track Skip Only"
+ swcodec: "Manual Track Skip Only"
@@ -1669,7 +1669,7 @@
user: core
*: none
@@ -1677,7 +1677,7 @@
*: none
- swcodec: "Shuffle and Track Skip"
+ swcodec: "Shuffle and Manual Track Skip"
diff --git a/apps/lang/nederlands.lang b/apps/lang/nederlands.lang
index 2f946fb9a2..ea7bfecb91 100644
--- a/apps/lang/nederlands.lang
+++ b/apps/lang/nederlands.lang
@@ -2693,12 +2693,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -9671,15 +9671,15 @@
user: core
*: none
- swcodec: "Shuffle and Track Skip"
+ swcodec: "Shuffle and Manual Track Skip"
*: none
- swcodec: "Shuffle and Track Skip"
+ swcodec: "Shuffle and Manual Track Skip"
diff --git a/apps/lang/norsk-nynorsk.lang b/apps/lang/norsk-nynorsk.lang
index e10057851e..bfd59ee285 100644
--- a/apps/lang/norsk-nynorsk.lang
+++ b/apps/lang/norsk-nynorsk.lang
@@ -2641,12 +2641,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -9355,7 +9355,7 @@
user: core
*: none
diff --git a/apps/lang/norsk.lang b/apps/lang/norsk.lang
index 526e3d6927..3072c515fd 100644
--- a/apps/lang/norsk.lang
+++ b/apps/lang/norsk.lang
@@ -7502,12 +7502,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -8905,7 +8905,7 @@
user: core
*: none
diff --git a/apps/lang/polski.lang b/apps/lang/polski.lang
index 5f60c7730a..9197857f44 100644
--- a/apps/lang/polski.lang
+++ b/apps/lang/polski.lang
@@ -1675,12 +1675,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1697,7 +1697,7 @@
user: core
*: none
diff --git a/apps/lang/portugues-brasileiro.lang b/apps/lang/portugues-brasileiro.lang
index e078355e9b..e3dfa91445 100644
--- a/apps/lang/portugues-brasileiro.lang
+++ b/apps/lang/portugues-brasileiro.lang
@@ -1666,12 +1666,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1688,7 +1688,7 @@
user: core
*: none
diff --git a/apps/lang/portugues.lang b/apps/lang/portugues.lang
index 899dbe7abb..97cdbf7f6c 100644
--- a/apps/lang/portugues.lang
+++ b/apps/lang/portugues.lang
@@ -8224,7 +8224,7 @@
user: core
*: none
@@ -9569,12 +9569,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
diff --git a/apps/lang/romaneste.lang b/apps/lang/romaneste.lang
index 5b73499997..f05113f729 100644
--- a/apps/lang/romaneste.lang
+++ b/apps/lang/romaneste.lang
@@ -4930,7 +4930,7 @@
user: core
*: none
@@ -8782,12 +8782,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
diff --git a/apps/lang/russian.lang b/apps/lang/russian.lang
index 78baed1653..b567f02c67 100644
--- a/apps/lang/russian.lang
+++ b/apps/lang/russian.lang
@@ -8761,7 +8761,7 @@
user: core
*: none
@@ -10294,12 +10294,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
diff --git a/apps/lang/srpski.lang b/apps/lang/srpski.lang
index 027f9c0d3a..7e9efb4f57 100644
--- a/apps/lang/srpski.lang
+++ b/apps/lang/srpski.lang
@@ -1650,12 +1650,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1672,7 +1672,7 @@
user: core
*: none
diff --git a/apps/lang/svenska.lang b/apps/lang/svenska.lang
index cfddc73c75..a3dcdf51ea 100644
--- a/apps/lang/svenska.lang
+++ b/apps/lang/svenska.lang
@@ -1672,12 +1672,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1694,7 +1694,7 @@
user: core
*: none
diff --git a/apps/lang/tagalog.lang b/apps/lang/tagalog.lang
index 4b71d75839..cb997691c0 100644
--- a/apps/lang/tagalog.lang
+++ b/apps/lang/tagalog.lang
@@ -1649,12 +1649,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1662,7 +1662,7 @@
*: none
- swcodec: "Track Skip Only"
+ swcodec: "Manual Track Skip Only"
@@ -1671,7 +1671,7 @@
user: core
*: none
@@ -1679,7 +1679,7 @@
*: none
- swcodec: "Shuffle and Track Skip"
+ swcodec: "Shuffle and Manual Track Skip"
diff --git a/apps/lang/thai.lang b/apps/lang/thai.lang
index 9b869853fb..55fa218121 100644
--- a/apps/lang/thai.lang
+++ b/apps/lang/thai.lang
@@ -1648,12 +1648,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1661,7 +1661,7 @@
*: none
- swcodec: "Track Skip Only"
+ swcodec: "Manual Track Skip Only"
@@ -1670,7 +1670,7 @@
user: core
*: none
@@ -1678,7 +1678,7 @@
*: none
- swcodec: "Shuffle and Track Skip"
+ swcodec: "Shuffle and Manual Track Skip"
diff --git a/apps/lang/ukrainian.lang b/apps/lang/ukrainian.lang
index ba8818e2ab..63eec1b4de 100644
--- a/apps/lang/ukrainian.lang
+++ b/apps/lang/ukrainian.lang
@@ -1665,12 +1665,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1687,7 +1687,7 @@
user: core
*: none
diff --git a/apps/lang/walon.lang b/apps/lang/walon.lang
index daa49086fe..3bd8afe125 100644
--- a/apps/lang/walon.lang
+++ b/apps/lang/walon.lang
@@ -1672,12 +1672,12 @@
- id: LANG_TRACKSKIP
+ id: LANG_MANTRACKSKIP
desc: in crossfade settings
user: core
*: none
@@ -1694,7 +1694,7 @@
user: core
*: none
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index 75d8152f7e..580dc315a7 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -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)
diff --git a/apps/playback.c b/apps/playback.c
index 2c9ca10311..57aca136a1 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -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;
}
diff --git a/apps/settings.h b/apps/settings.h
index 4ab2d8945d..ffadfa9eee 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -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,
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 9f290e2a18..1a9f7f2d6e 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -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,
diff --git a/manual/configure_rockbox/playback_options.tex b/manual/configure_rockbox/playback_options.tex
index 41bc75de4e..f9f1db01f2 100644
--- a/manual/configure_rockbox/playback_options.tex
+++ b/manual/configure_rockbox/playback_options.tex
@@ -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