From df08c4e1adf701068e9c00dd2e2fd40d248c9bb2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Sep 2023 18:49:44 +0900 Subject: [PATCH] Disable decoupling for `OsuGameBase`'s beatmap implementation This avoids it ever mutating the underlying track (aka attempting to start it). Resolves the one caveat mentioned in aeef92fa710648d4a00edc523e13c17ac6104125. --- osu.Game/Beatmaps/FramedBeatmapClock.cs | 8 ++++---- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Screens/Edit/EditorClock.cs | 2 +- osu.Game/Screens/Play/GameplayClockContainer.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/FramedBeatmapClock.cs b/osu.Game/Beatmaps/FramedBeatmapClock.cs index cd349e6c29..d738333a98 100644 --- a/osu.Game/Beatmaps/FramedBeatmapClock.cs +++ b/osu.Game/Beatmaps/FramedBeatmapClock.cs @@ -56,14 +56,14 @@ namespace osu.Game.Beatmaps public bool IsRewinding { get; private set; } - public FramedBeatmapClock(bool applyOffsets = false) + public FramedBeatmapClock(bool applyOffsets, bool requireDecoupling) { this.applyOffsets = applyOffsets; - // A decoupled clock is used to ensure precise time values even when the host audio subsystem is not reporting - // high precision times (on windows there's generally only 5-10ms reporting intervals, as an example). - decoupledTrack = new DecouplingClock(); + decoupledTrack = new DecouplingClock { AllowDecoupling = requireDecoupling }; + // An interpolating clock is used to ensure precise time values even when the host audio subsystem is not reporting + // high precision times (on windows there's generally only 5-10ms reporting intervals, as an example). var interpolatedTrack = new InterpolatingFramedClock(decoupledTrack); if (applyOffsets) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c946362124..1f46eb0c0d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -215,7 +215,7 @@ namespace osu.Game /// For now, this is used as a source specifically for beat synced components. /// Going forward, it could potentially be used as the single source-of-truth for beatmap timing. /// - private readonly FramedBeatmapClock beatmapClock = new FramedBeatmapClock(true); + private readonly FramedBeatmapClock beatmapClock = new FramedBeatmapClock(applyOffsets: true, requireDecoupling: false); protected override Container Content => content; diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index 108552b61c..d4de1bae5f 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit this.beatDivisor = beatDivisor ?? new BindableBeatDivisor(); - underlyingClock = new FramedBeatmapClock(applyOffsets: true); + underlyingClock = new FramedBeatmapClock(applyOffsets: true, requireDecoupling: true); AddInternal(underlyingClock); } diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index ba034b079f..2a27d33047 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Play InternalChildren = new Drawable[] { - GameplayClock = new FramedBeatmapClock(applyOffsets), + GameplayClock = new FramedBeatmapClock(applyOffsets, requireDecoupling: true), Content }; }