player/CrossFade: add method IsMixRampEnabled()

This commit is contained in:
Max Kellermann 2021-12-03 23:22:49 +01:00
parent dda521a150
commit 2518612b1b
2 changed files with 5 additions and 1 deletions

View File

@ -118,7 +118,7 @@ CrossFadeSettings::Calculate(SignedSongTime current_total_time,
const auto chunk_duration =
af.SizeToTime<FloatDuration>(sizeof(MusicChunk::data));
if (mixramp_delay <= FloatDuration::zero() ||
if (!IsMixRampEnabled() ||
!mixramp_start || !mixramp_prev_end) {
chunks = lround(duration / chunk_duration);
} else {

View File

@ -48,6 +48,10 @@ struct CrossFadeSettings {
return duration.count() > 0;
}
constexpr bool IsMixRampEnabled() const noexcept {
return mixramp_delay > FloatDuration::zero();
}
/**
* Calculate how many music pipe chunks should be used for crossfading.
*