From 619f2f1093c7a1a05743d87f6ffb5f218e2d790b Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Tue, 6 Oct 2026 23:38:25 -0400 Subject: [PATCH] afr: fix gapless playback with fatigue reduction enabled afr_configure() returned 1 for every message. For DSP_PROC_NEW_FORMAT that is PROC_NEW_FORMAT_DEACTIVATED, so the DSP did not call the stage for the buffer that brought a new format: the first buffer of each track went out unfiltered, and the filters started on the second. That is 128 samples of a WAV file, and the whole first block of a codec with 32-bit non-interleaved output, 4608 samples of a FLAC file. A codec sets the format again at the start of every track, so between gapless tracks this put a short stretch of unfiltered audio into filtered audio, heard as a click at the join. Return 0, as the other stages do. Found with test_codec's DSP checksums on a Sansa Clip+: a model of the DSP with fatigue reduction left out of each file's first buffer reproduces the sixteen checksums of two runs, and none of them with it left in. Listening on the same player, the click between gapless tracks is gone with this change. Change-Id: I7a1193fa0a4ee0c983cbcc5c1af201e1678579d0 Co-Authored-By: Claude Opus 5.5 --- lib/rbcodec/dsp/afr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rbcodec/dsp/afr.c b/lib/rbcodec/dsp/afr.c index 0ec2b2cf4e..dcdafba591 100644 --- a/lib/rbcodec/dsp/afr.c +++ b/lib/rbcodec/dsp/afr.c @@ -137,7 +137,7 @@ static intptr_t afr_configure(struct dsp_proc_entry *this, break; } - return 1; + return 0; } /* Database entry */