mirror of
https://github.com/ppy/osu.git
synced 2024-09-21 14:47:25 +08:00
Centralise calls to end high performance sessions
This commit is contained in:
parent
b01fb2a5bf
commit
57fe5bdcfc
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ManagedBass.Fx;
|
using ManagedBass.Fx;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -288,8 +289,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Debug.Assert(CurrentPlayer != null);
|
Debug.Assert(CurrentPlayer != null);
|
||||||
|
|
||||||
highPerformanceSession?.Dispose();
|
endHighPerformance();
|
||||||
highPerformanceSession = null;
|
|
||||||
|
|
||||||
// prepare for a retry.
|
// prepare for a retry.
|
||||||
CurrentPlayer = null;
|
CurrentPlayer = null;
|
||||||
@ -329,8 +329,7 @@ namespace osu.Game.Screens.Play
|
|||||||
BackgroundBrightnessReduction = false;
|
BackgroundBrightnessReduction = false;
|
||||||
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
|
||||||
highPerformanceSession?.Dispose();
|
endHighPerformance();
|
||||||
highPerformanceSession = null;
|
|
||||||
|
|
||||||
return base.OnExiting(e);
|
return base.OnExiting(e);
|
||||||
}
|
}
|
||||||
@ -531,11 +530,7 @@ namespace osu.Game.Screens.Play
|
|||||||
// ensure that once we have reached this "point of no return", readyForPush will be false for all future checks (until a new player instance is prepared).
|
// ensure that once we have reached this "point of no return", readyForPush will be false for all future checks (until a new player instance is prepared).
|
||||||
Player consumedPlayer = consumePlayer();
|
Player consumedPlayer = consumePlayer();
|
||||||
|
|
||||||
consumedPlayer.OnShowingResults += () =>
|
consumedPlayer.OnShowingResults += endHighPerformance;
|
||||||
{
|
|
||||||
highPerformanceSession?.Dispose();
|
|
||||||
highPerformanceSession = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
ContentOut();
|
ContentOut();
|
||||||
|
|
||||||
@ -568,6 +563,8 @@ namespace osu.Game.Screens.Play
|
|||||||
scheduledPushPlayer = null;
|
scheduledPushPlayer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void endHighPerformance() => Interlocked.Exchange(ref highPerformanceSession, null)?.Dispose();
|
||||||
|
|
||||||
#region Disposal
|
#region Disposal
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
@ -580,8 +577,7 @@ namespace osu.Game.Screens.Play
|
|||||||
DisposalTask = LoadTask?.ContinueWith(_ => CurrentPlayer?.Dispose());
|
DisposalTask = LoadTask?.ContinueWith(_ => CurrentPlayer?.Dispose());
|
||||||
}
|
}
|
||||||
|
|
||||||
highPerformanceSession?.Dispose();
|
endHighPerformance();
|
||||||
highPerformanceSession = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user