1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +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 ManagedBass.Fx;
using osu.Framework.Audio.Mixing;
using osu.Framework.Caching;
using osu.Framework.Graphics;
namespace osu.Game.Audio.Effects
@ -22,6 +23,8 @@ namespace osu.Game.Audio.Effects
private bool isAttached;
private readonly Cached filterApplication = new Cached();
private int cutoff;
/// <summary>
@ -36,7 +39,7 @@ namespace osu.Game.Audio.Effects
return;
cutoff = value;
updateFilter(cutoff);
filterApplication.Invalidate();
}
}
@ -61,6 +64,17 @@ namespace osu.Game.Audio.Effects
Cutoff = getInitialCutoff(type);
}
protected override void Update()
{
base.Update();
if (!filterApplication.IsValid)
{
updateFilter(cutoff);
filterApplication.Validate();
}
}
private int getInitialCutoff(BQFType type)
{
switch (type)