diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 969527a758..4168dda867 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -15,6 +15,7 @@ using osu.Framework.Input; using osu.Framework.Screens; using osu.Framework.Threading; +using osu.Game.Audio.Effects; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -63,6 +64,8 @@ public class PlayerLoader : ScreenWithBeatmapBackground private readonly BindableDouble volumeAdjustment = new BindableDouble(1); + private Filter lpFilter; + protected bool BackgroundBrightnessReduction { set @@ -127,7 +130,7 @@ public PlayerLoader(Func createPlayer) } [BackgroundDependencyLoader] - private void load(SessionStatics sessionStatics) + private void load(SessionStatics sessionStatics, AudioManager audio) { muteWarningShownOnce = sessionStatics.GetBindable(Static.MutedAudioNotificationShownOnce); batteryWarningShownOnce = sessionStatics.GetBindable(Static.LowBatteryNotificationShownOnce); @@ -159,7 +162,8 @@ private void load(SessionStatics sessionStatics) new InputSettings() } }, - idleTracker = new IdleTracker(750) + idleTracker = new IdleTracker(750), + lpFilter = new Filter(audio.TrackMixer) }); if (Beatmap.Value.BeatmapInfo.EpilepsyWarning) @@ -191,6 +195,7 @@ public override void OnEntering(IScreen last) epilepsyWarning.DimmableBackground = b; }); + lpFilter.CutoffTo(500, 100, Easing.OutCubic); Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment); content.ScaleTo(0.7f); @@ -229,6 +234,7 @@ public override void OnSuspending(IScreen next) // stop the track before removing adjustment to avoid a volume spike. Beatmap.Value.Track.Stop(); Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment); + lpFilter.CutoffTo(lpFilter.MaxCutoff); } public override bool OnExiting(IScreen next) @@ -242,6 +248,7 @@ public override bool OnExiting(IScreen next) BackgroundBrightnessReduction = false; Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment); + lpFilter.CutoffTo(lpFilter.MaxCutoff, 100, Easing.InCubic); return base.OnExiting(next); }