diff --git a/osu.Game/Screens/Play/FailAnimation.cs b/osu.Game/Screens/Play/FailAnimation.cs index 71bea2a145..e250791b72 100644 --- a/osu.Game/Screens/Play/FailAnimation.cs +++ b/osu.Game/Screens/Play/FailAnimation.cs @@ -10,7 +10,9 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Utils; +using osu.Game.Audio.Effects; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Drawables; using osuTK; @@ -22,7 +24,7 @@ namespace osu.Game.Screens.Play /// Manage the animation to be applied when a player fails. /// Single file; automatically disposed after use. /// - public class FailAnimation : Component + public class FailAnimation : CompositeDrawable { public Action OnComplete; @@ -32,6 +34,8 @@ namespace osu.Game.Screens.Play private Track track; + private AudioFilter failLowPassFilter; + private const float duration = 2500; private Sample failSample; @@ -46,6 +50,8 @@ namespace osu.Game.Screens.Play { track = beatmap.Value.Track; failSample = audio.Samples.Get(@"Gameplay/failsound"); + + AddInternal(failLowPassFilter = new AudioFilter(audio.TrackMixer)); } private bool started; @@ -68,6 +74,8 @@ namespace osu.Game.Screens.Play Expire(); }); + failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic); + track.AddAdjustment(AdjustableProperty.Frequency, trackFreq); applyToPlayfield(drawableRuleset.Playfield); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 30ba2bfe6d..090210e611 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -15,7 +15,6 @@ using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; -using osu.Game.Audio.Effects; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics.Containers; @@ -215,7 +214,6 @@ namespace osu.Game.Screens.Play InternalChild = GameplayClockContainer = CreateGameplayClockContainer(Beatmap.Value, DrawableRuleset.GameplayStartTime); AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer)); - AddInternal(failLowPassFilter = new AudioFilter(audio.TrackMixer)); Score = CreateScore(playableBeatmap); @@ -770,8 +768,6 @@ namespace osu.Game.Screens.Play private FailAnimation failAnimation; - private AudioFilter failLowPassFilter; - private bool onFail() { if (!CheckModsAllowFailure()) @@ -786,7 +782,6 @@ namespace osu.Game.Screens.Play if (PauseOverlay.State.Value == Visibility.Visible) PauseOverlay.Hide(); - failLowPassFilter.CutoffTo(300, 2500, Easing.OutCubic); failAnimation.Start(); if (GameplayState.Mods.OfType().Any(m => m.RestartOnFail)) @@ -799,7 +794,6 @@ namespace osu.Game.Screens.Play private void onFailComplete() { GameplayClockContainer.Stop(); - failLowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF); FailOverlay.Retries = RestartCount; FailOverlay.Show();