1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Merge pull request #26707 from peppy/beat-sync-container-early-adjust

Adjust `BeatSyncContainer`'s early animate offset based on source's rate
This commit is contained in:
Bartłomiej Dach 2024-03-26 18:43:25 +01:00 committed by GitHub
commit 6ef54321c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
private SessionStatics statics { get; set; } = null!;
private ScoreAccessibleSoloPlayer currentPlayer = null!;
private readonly ManualClock manualClock = new ManualClock { Rate = 0 };
private readonly ManualClock manualClock = new ManualClock { Rate = 1 };
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard? storyboard = null)
=> new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(manualClock), Audio);

View File

@ -91,7 +91,16 @@ 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.
// We can adjust here to ensure the applied early activation always matches expectations.
if (Clock.Rate > 0)
early *= BeatSyncSource.Clock.Rate / Clock.Rate;
currentTrackTime = BeatSyncSource.Clock.CurrentTime + early;
timingPoint = BeatSyncSource.ControlPoints?.TimingPointAt(currentTrackTime) ?? TimingControlPoint.DEFAULT;
effectPoint = BeatSyncSource.ControlPoints?.EffectPointAt(currentTrackTime) ?? EffectControlPoint.DEFAULT;