Skip to content

Commit

Permalink
Remove unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytra committed Nov 25, 2024
1 parent e2f5753 commit d82b1c8
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions ProjectObsidian/Components/Audio/AudioLowPassFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,30 @@ public class AudioLowPassFilter : Component, IAudioSource, IWorldElement

public readonly SyncRef<IAudioSource> Source;

private double lastAudioTime;

public bool IsActive
{
get
{
return Source.Target.IsActive;
return Source.Target != null && Source.Target.IsActive;
}
}

public int ChannelCount => Source.Target?.ChannelCount ?? 0;

public void Read<S>(Span<S> buffer) where S : unmanaged, IAudioSample<S>
{
double dSPTime = base.Engine.AudioSystem.DSPTime;
if (lastAudioTime != dSPTime)
{
lastAudioTime = dSPTime;
}

Span<S> span = stackalloc S[buffer.Length];

if (!IsActive)
{
return;
}

Span<S> span2 = span;
span2 = buffer;
Span<S> span = stackalloc S[buffer.Length];

span = buffer;

Source.Target.Read(span2);
Source.Target.Read(span);

EMAIIRSmoothSignal(ref span2, span2.Length, SmoothingFactor);
EMAIIRSmoothSignal(ref span, span.Length, SmoothingFactor);
}

// smoothingFactor is between 0.0 (no smoothing) and 0.9999.. (almost smoothing to DC) - *kind* of the inverse of cutoff frequency
Expand Down

0 comments on commit d82b1c8

Please sign in to comment.