Fix test failures

This commit is contained in:
Dean Herbert 2021-10-15 21:22:38 +09:00
parent b9fd1f52df
commit 6f947cacbd
2 changed files with 20 additions and 4 deletions

View File

@ -33,6 +33,8 @@ namespace osu.Game.Screens.Play
private readonly DrawableRuleset drawableRuleset; private readonly DrawableRuleset drawableRuleset;
private readonly BindableDouble trackFreq = new BindableDouble(1); private readonly BindableDouble trackFreq = new BindableDouble(1);
private Container filters;
private Box failFlash; private Box failFlash;
private Track track; private Track track;
@ -66,8 +68,14 @@ namespace osu.Game.Screens.Play
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
failLowPassFilter = new AudioFilter(audio.TrackMixer), filters = new Container
failHighPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass), {
Children = new Drawable[]
{
failLowPassFilter = new AudioFilter(audio.TrackMixer),
failHighPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass),
},
},
Content, Content,
failFlash = new Box failFlash = new Box
{ {
@ -122,6 +130,14 @@ namespace osu.Game.Screens.Play
Content.FadeColour(Color4.Gray, duration); Content.FadeColour(Color4.Gray, duration);
} }
public void RemoveFilters()
{
RemoveInternal(filters);
filters.Dispose();
track?.RemoveAdjustment(AdjustableProperty.Frequency, trackFreq);
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
@ -172,7 +188,7 @@ namespace osu.Game.Screens.Play
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
track?.RemoveAdjustment(AdjustableProperty.Frequency, trackFreq); RemoveFilters();
} }
} }
} }

View File

@ -965,7 +965,7 @@ namespace osu.Game.Screens.Play
public override bool OnExiting(IScreen next) public override bool OnExiting(IScreen next)
{ {
screenSuspension?.RemoveAndDisposeImmediately(); screenSuspension?.RemoveAndDisposeImmediately();
failAnimationLayer?.RemoveAndDisposeImmediately(); failAnimationLayer?.RemoveFilters();
// if arriving here and the results screen preparation task hasn't run, it's safe to say the user has not completed the beatmap. // if arriving here and the results screen preparation task hasn't run, it's safe to say the user has not completed the beatmap.
if (prepareScoreForDisplayTask == null) if (prepareScoreForDisplayTask == null)