1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 19:27:26 +08:00

Merge pull request #22339 from shinobu-uwu/fix-fail-sample-playing-after-leaving-dialog

Fix skin fail sound continuing to play after leaving gameplay
This commit is contained in:
Dean Herbert 2023-01-22 22:27:26 +09:00 committed by GitHub
commit 9a89dfb7d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 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!;
@ -119,13 +120,13 @@ namespace osu.Game.Screens.Play
this.TransformBindableTo(trackFreq, 0, duration).OnComplete(_ =>
{
// Don't reset frequency as the pause screen may appear post transform, causing a second frequency sweep.
RemoveFilters(false);
removeFilters(false);
OnComplete?.Invoke();
});
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,7 +154,16 @@ namespace osu.Game.Screens.Play
Background?.FadeColour(OsuColour.Gray(0.3f), 60);
}
public void RemoveFilters(bool resetTrackFrequency = true)
/// <summary>
/// Stops any and all persistent effects added by the ongoing fail animation.
/// </summary>
public void Stop()
{
failSampleChannel?.Stop();
removeFilters();
}
private void removeFilters(bool resetTrackFrequency = true)
{
filtersRemoved = true;

View File

@ -1072,7 +1072,7 @@ namespace osu.Game.Screens.Play
public override bool OnExiting(ScreenExitEvent e)
{
screenSuspension?.RemoveAndDisposeImmediately();
failAnimationLayer?.RemoveFilters();
failAnimationLayer?.Stop();
if (LoadedBeatmapSuccessfully)
{