Expose AudioFilter.IsAttached publicly

This commit is contained in:
Dean Herbert 2024-02-26 21:15:44 +08:00
parent 09b420a083
commit 7a96cf1289
No known key found for this signature in database

View File

@ -17,12 +17,15 @@ namespace osu.Game.Audio.Effects
/// </summary> /// </summary>
public const int MAX_LOWPASS_CUTOFF = 22049; // nyquist - 1hz public const int MAX_LOWPASS_CUTOFF = 22049; // nyquist - 1hz
/// <summary>
/// Whether this filter is currently attached to the audio track and thus applying an adjustment.
/// </summary>
public bool IsAttached { get; private set; }
private readonly AudioMixer mixer; private readonly AudioMixer mixer;
private readonly BQFParameters filter; private readonly BQFParameters filter;
private readonly BQFType type; private readonly BQFType type;
private bool isAttached;
private readonly Cached filterApplication = new Cached(); private readonly Cached filterApplication = new Cached();
private int cutoff; private int cutoff;
@ -132,22 +135,22 @@ namespace osu.Game.Audio.Effects
private void ensureAttached() private void ensureAttached()
{ {
if (isAttached) if (IsAttached)
return; return;
Debug.Assert(!mixer.Effects.Contains(filter)); Debug.Assert(!mixer.Effects.Contains(filter));
mixer.Effects.Add(filter); mixer.Effects.Add(filter);
isAttached = true; IsAttached = true;
} }
private void ensureDetached() private void ensureDetached()
{ {
if (!isAttached) if (!IsAttached)
return; return;
Debug.Assert(mixer.Effects.Contains(filter)); Debug.Assert(mixer.Effects.Contains(filter));
mixer.Effects.Remove(filter); mixer.Effects.Remove(filter);
isAttached = false; IsAttached = false;
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)