Skip to content

Commit

Permalink
Remove "pause rate adjust" flow
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Jan 18, 2024
1 parent 799c74c commit 8ab8c90
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
11 changes: 3 additions & 8 deletions osu.Game/Beatmaps/FramedBeatmapClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ public partial class FramedBeatmapClock : Component, IFrameBasedClock, IAdjustab
{
private readonly bool applyOffsets;

/// <summary>
/// The total frequency adjustment from pause transforms. Should eventually be handled in a better way.
/// </summary>
public readonly BindableDouble ExternalPauseFrequencyAdjust = new BindableDouble(1);

private readonly OffsetCorrectionClock? userGlobalOffsetClock;
private readonly OffsetCorrectionClock? platformOffsetClock;
private readonly OffsetCorrectionClock? userBeatmapOffsetClock;
Expand Down Expand Up @@ -69,13 +64,13 @@ public FramedBeatmapClock(bool applyOffsets, bool requireDecoupling, IClock? sou
{
// Audio timings in general with newer BASS versions don't match stable.
// This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
platformOffsetClock = new OffsetCorrectionClock(interpolatedTrack, ExternalPauseFrequencyAdjust) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 15 : 0 };
platformOffsetClock = new OffsetCorrectionClock(interpolatedTrack) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 15 : 0 };

// User global offset (set in settings) should also be applied.
userGlobalOffsetClock = new OffsetCorrectionClock(platformOffsetClock, ExternalPauseFrequencyAdjust);
userGlobalOffsetClock = new OffsetCorrectionClock(platformOffsetClock);

// User per-beatmap offset will be applied to this final clock.
finalClockSource = userBeatmapOffsetClock = new OffsetCorrectionClock(userGlobalOffsetClock, ExternalPauseFrequencyAdjust);
finalClockSource = userBeatmapOffsetClock = new OffsetCorrectionClock(userGlobalOffsetClock);
}
else
{
Expand Down
2 changes: 0 additions & 2 deletions osu.Game/Screens/Play/MasterGameplayClockContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ private void addAdjustmentsToTrack()
musicController.ResetTrackAdjustments();

track.BindAdjustments(AdjustmentsFromMods);
track.AddAdjustment(AdjustableProperty.Frequency, GameplayClock.ExternalPauseFrequencyAdjust);
track.AddAdjustment(AdjustableProperty.Frequency, UserPlaybackRate);

speedAdjustmentsApplied = true;
Expand All @@ -219,7 +218,6 @@ private void removeAdjustmentsFromTrack()
return;

track.UnbindAdjustments(AdjustmentsFromMods);
track.RemoveAdjustment(AdjustableProperty.Frequency, GameplayClock.ExternalPauseFrequencyAdjust);
track.RemoveAdjustment(AdjustableProperty.Frequency, UserPlaybackRate);

speedAdjustmentsApplied = false;
Expand Down
14 changes: 3 additions & 11 deletions osu.Game/Screens/Play/OffsetCorrectionClock.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Bindables;
using osu.Framework.Timing;

namespace osu.Game.Screens.Play
{
public class OffsetCorrectionClock : FramedOffsetClock
{
private readonly BindableDouble pauseRateAdjust;

private double offset;

public new double Offset
Expand All @@ -28,10 +25,9 @@ public class OffsetCorrectionClock : FramedOffsetClock

public double RateAdjustedOffset => base.Offset;

public OffsetCorrectionClock(IClock source, BindableDouble pauseRateAdjust)
public OffsetCorrectionClock(IClock source)
: base(source)
{
this.pauseRateAdjust = pauseRateAdjust;
}

public override void ProcessFrame()
Expand All @@ -42,12 +38,8 @@ public override void ProcessFrame()

private void updateOffset()
{
// changing this during the pause transform effect will cause a potentially large offset to be suddenly applied as we approach zero rate.
if (pauseRateAdjust.Value == 1)
{
// we always want to apply the same real-time offset, so it should be adjusted by the difference in playback rate (from realtime) to achieve this.
base.Offset = Offset * Rate;
}
// we always want to apply the same real-time offset, so it should be adjusted by the difference in playback rate (from realtime) to achieve this.
base.Offset = Offset * Rate;
}
}
}

0 comments on commit 8ab8c90

Please sign in to comment.