mirror of
https://github.com/ppy/osu.git
synced 2025-02-12 23:12:59 +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:
parent
4d4d69521f
commit
998d820666
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user