1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 00:07:19 +08:00

Adjust BeatSyncContainer's early animate offset based on source's rate

This commit is contained in:
Dean Herbert 2024-01-25 21:28:08 +09:00
parent baaf33d995
commit 3f9c2b41f7
No known key found for this signature in database

View File

@ -91,7 +91,17 @@ namespace osu.Game.Graphics.Containers
if (IsBeatSyncedWithTrack)
{
currentTrackTime = BeatSyncSource.Clock.CurrentTime + EarlyActivationMilliseconds;
double early = EarlyActivationMilliseconds;
// In the case of gameplay, we are usually within a hierarchy with the correct rate applied to our `Drawable.Clock`.
// This means that the amount of early adjustment is adjusted in line with audio track rate changes.
// But other cases like the osu! logo at the main menu won't correctly have this rate information.
//
// So for cases where the rate of the source isn't in sync with our hierarchy, let's assume we need to account for it locally.
if (Clock.Rate == 1 && BeatSyncSource.Clock.Rate != Clock.Rate)
early *= BeatSyncSource.Clock.Rate;
currentTrackTime = BeatSyncSource.Clock.CurrentTime + early;
timingPoint = BeatSyncSource.ControlPoints?.TimingPointAt(currentTrackTime) ?? TimingControlPoint.DEFAULT;
effectPoint = BeatSyncSource.ControlPoints?.EffectPointAt(currentTrackTime) ?? EffectControlPoint.DEFAULT;