1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 01:33:10 +08:00

Ensure audio filters can't be attached before load (or post-disposal)

Will probably fix https://github.com/ppy/osu/issues/27225?
This commit is contained in:
Dean Herbert 2024-02-19 00:21:54 +08:00
parent 4d4d69521f
commit 998d820666
No known key found for this signature in database

View File

@ -4,6 +4,7 @@
using System.Diagnostics; using System.Diagnostics;
using ManagedBass.Fx; using ManagedBass.Fx;
using osu.Framework.Audio.Mixing; using osu.Framework.Audio.Mixing;
using osu.Framework.Caching;
using osu.Framework.Graphics; using osu.Framework.Graphics;
namespace osu.Game.Audio.Effects namespace osu.Game.Audio.Effects
@ -22,6 +23,8 @@ namespace osu.Game.Audio.Effects
private bool isAttached; private bool isAttached;
private readonly Cached filterApplication = new Cached();
private int cutoff; private int cutoff;
/// <summary> /// <summary>
@ -36,7 +39,7 @@ namespace osu.Game.Audio.Effects
return; return;
cutoff = value; cutoff = value;
updateFilter(cutoff); filterApplication.Invalidate();
} }
} }
@ -61,6 +64,17 @@ namespace osu.Game.Audio.Effects
Cutoff = getInitialCutoff(type); Cutoff = getInitialCutoff(type);
} }
protected override void Update()
{
base.Update();
if (!filterApplication.IsValid)
{
updateFilter(cutoff);
filterApplication.Validate();
}
}
private int getInitialCutoff(BQFType type) private int getInitialCutoff(BQFType type)
{ {
switch (type) switch (type)