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:
commit
9a89dfb7d1
@ -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;
|
||||
|
||||
|
@ -1072,7 +1072,7 @@ namespace osu.Game.Screens.Play
|
||||
public override bool OnExiting(ScreenExitEvent e)
|
||||
{
|
||||
screenSuspension?.RemoveAndDisposeImmediately();
|
||||
failAnimationLayer?.RemoveFilters();
|
||||
failAnimationLayer?.Stop();
|
||||
|
||||
if (LoadedBeatmapSuccessfully)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user