1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-23 10:20:07 +08:00

Move full track adjustment flow inside MasterGameplayClockContainer

This commit is contained in:
Dean Herbert
2022-09-07 19:12:16 +09:00
Unverified
parent 75d0deef72
commit fa15502384
2 changed files with 9 additions and 10 deletions
@@ -3,6 +3,7 @@
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
@@ -10,6 +11,7 @@ using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Overlays;
namespace osu.Game.Screens.Play
{
@@ -55,6 +57,9 @@ namespace osu.Game.Screens.Play
/// </summary>
private double? actualStopTime;
[Resolved]
private MusicController musicController { get; set; } = null!;
/// <summary>
/// Create a new master gameplay clock container.
/// </summary>
@@ -193,6 +198,8 @@ namespace osu.Game.Screens.Play
if (speedAdjustmentsApplied)
return;
musicController.ResetTrackAdjustments();
track.BindAdjustments(GameplayAdjustments);
track.AddAdjustment(AdjustableProperty.Frequency, GameplayClock.ExternalPauseFrequencyAdjust);
track.AddAdjustment(AdjustableProperty.Tempo, UserPlaybackRate);
+2 -10
View File
@@ -996,16 +996,8 @@ namespace osu.Game.Screens.Play
foreach (var mod in GameplayState.Mods.OfType<IApplicableToHUD>())
mod.ApplyToHUD(HUDOverlay);
// Our mods are local copies of the global mods so they need to be re-applied to the track.
// This is done through the music controller (for now), because resetting speed adjustments on the beatmap track also removes adjustments provided by DrawableTrack.
// Todo: In the future, player will receive in a track and will probably not have to worry about this...
if (GameplayClockContainer is MasterGameplayClockContainer masterClock)
{
musicController.ResetTrackAdjustments();
foreach (var mod in GameplayState.Mods.OfType<IApplicableToTrack>())
mod.ApplyToTrack(masterClock.GameplayAdjustments);
}
foreach (var mod in GameplayState.Mods.OfType<IApplicableToTrack>())
mod.ApplyToTrack(GameplayClockContainer.GameplayAdjustments);
updateGameplayState();