Remove autocue specific crossfade code. - #4893
Merged
Merged
Conversation
toots
force-pushed
the
cleanup-crossfade
branch
from
February 12, 2026 15:33
562f7dd to
12d2fed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We did a lot of conditional change on the
crossfadecode around the2.3.xrelease. The reason for these conditional changes was that we were trying to keep existing behavior while working on a new one with @RM-FM and @Moonbase59Now it's time to clean it up!
Looking at the code, here's what makes sense to me:
crossfade_duration.fade.induration is not more than the buffered data. If so, we have to reduce the duration.fade.outduration is longer than the buffered data, same deal, we reduce itFor these reasons:
start_durationandend_durationare also removed.Lastly, ever since that work happened, we have considered that metadata beginning with
liq_should be considered internal to liquidsoap. If you need to pass your own custom metadata, please avoid this prefix and if you're messing with them, we won't guarantee that what you're expecting won't break from one version to the next.This is because we want to be able to adjust these values according to our internal implementation, which may change. Typically, for
autocueimplementation, we provide a return type for the function:And convert that to the appropriate metadata internally.
Here are some generated ASCII diagrams explaining this:
1. Buffering Phase
Buffer
crossfade_durationfrom each track:If
A_duration ≠ B_duration, the side with more data keeps extra outside the overlap:Case A:
A_duration > B_duration— Extra data on the left (ending track)Case B:
B_duration > A_duration— Extra data on the right (starting track)2. Common Crossfade Window
Uses minimum of both buffers:
3. Fade.in Behavior (Starting Track B)
Case A:
fade.in ≤ buffer— OK, reaches full volume before endCase B:
fade.in > buffer— Reduce fade.in to fit4. Fade.out Behavior (Ending Track A)
Case A:
fade.out > buffer— Reduce fade.out to fitCase B:
fade.out < buffer— Add delay so fade ends at buffer enddelay = buffer - fade.out
5. Example with Extra Data
When ending track (A) has more buffered data — extra on the left:
Result: Extra data from A plays before crossfade begins
When starting track (B) has more buffered data — extra on the right:
Result: Extra data from B plays after crossfade ends