1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 22:22:54 +08:00

Fix failSample still playing after player left FailOverlay

This commit is contained in:
Matheus Filipe dos Santos Reinert 2023-01-22 01:14:33 -03:00
parent 292fd345bc
commit a746cbc6ed
2 changed files with 10 additions and 1 deletions

View File

@ -51,6 +51,7 @@ namespace osu.Game.Screens.Play
private const float duration = 2500;
private ISample? failSample;
private SampleChannel? failSampleChannel;
[Resolved]
private OsuConfigManager config { get; set; } = null!;
@ -125,7 +126,7 @@ namespace osu.Game.Screens.Play
failHighPassFilter.CutoffTo(300);
failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic);
failSample?.Play();
failSampleChannel = failSample?.Play();
track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);
track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
@ -153,6 +154,11 @@ namespace osu.Game.Screens.Play
Background?.FadeColour(OsuColour.Gray(0.3f), 60);
}
public void StopSample()
{
failSampleChannel?.Stop();
}
public void RemoveFilters(bool resetTrackFrequency = true)
{
filtersRemoved = true;

View File

@ -612,6 +612,8 @@ namespace osu.Game.Screens.Play
// if an exit has been requested, cancel any pending completion (the user has shown intention to exit).
resultsDisplayDelegate?.Cancel();
failAnimationLayer.StopSample();
// The actual exit is performed if
// - the pause / fail dialog was not requested
// - the pause / fail dialog was requested but is already displayed (user showing intention to exit).
@ -678,6 +680,7 @@ namespace osu.Game.Screens.Play
sampleRestart?.Play();
RestartRequested?.Invoke(quickRestart);
failAnimationLayer.StopSample();
PerformExit(false);
}