Files
kaiju/Assets/WasapiAudio/Scripts/Unity/Transformers/SmoothSpectrumTransformer.cs
T
2022-01-18 17:10:16 +11:00

26 lines
683 B
C#

using System;
using Assets.WasapiAudio.Scripts.Core;
using UnityEngine;
namespace Assets.WasapiAudio.Scripts.Unity.Transformers
{
[Serializable]
public class SmoothSpectrumTransformer : SpectrumTransformer
{
private SpectrumSmoother _smoother;
[Range(1, 50)]
public byte Iterations = 1;
protected override void PerformTransform(float[] input, ref float[] output)
{
if (_smoother == null || _smoother.SmoothingIterations != Iterations)
{
_smoother = new SpectrumSmoother(input.Length, Iterations);
}
output = _smoother.GetSpectrumData(input);
}
}
}