From f0bd97539379ad11f54dbdf354f0adca7565044a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Oct 2023 18:16:12 +0900 Subject: [PATCH] Change `GameplayClockContainer.Reset` to directly call `GameplayClock.Stop` The reasoning is explained in the inline comment, but basically this was getting blocked by `isPaused` being in an initial `true` state (as it is on construction), while the source clock was still `IsRunning`. There's no real guarantee of sync between the source and the `isPaused` bindable right now. Maybe there should be in the future, but to restore sanity, let's ensure that a call to `Reset` can at least stop the track as we expect. --- osu.Game/Screens/Play/GameplayClockContainer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index e6a38a9946..3c920babee 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -138,12 +138,15 @@ namespace osu.Game.Screens.Play /// Resets this and the source to an initial state ready for gameplay. /// /// The time to seek to on resetting. If null, the existing will be used. - /// Whether to start the clock immediately, if not already started. + /// Whether to start the clock immediately. If false, the clock will remain stopped after this call. public void Reset(double? time = null, bool startClock = false) { bool wasPaused = isPaused.Value; - Stop(); + // The intention of the Reset method is to get things into a known sane state. + // As such, we intentionally stop the underlying clock directly here, bypassing Stop/StopGameplayClock. + // This is to avoid any kind of isPaused state checks and frequency ramping (as provided by MasterGameplayClockContainer). + GameplayClock.Stop(); if (time != null) StartTime = time.Value;