2019-09-29 19:53:47 +00:00
|
|
|
namespace cylvester
|
|
|
|
{
|
2019-10-04 13:35:23 +00:00
|
|
|
public interface ISpectrumArrayContainer
|
2019-09-29 19:53:47 +00:00
|
|
|
{
|
|
|
|
IPdArray this[int index] { get; }
|
2019-10-05 09:38:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public interface IUpdater
|
|
|
|
{
|
2019-09-29 19:53:47 +00:00
|
|
|
void Update();
|
|
|
|
}
|
|
|
|
|
2019-10-05 09:38:46 +00:00
|
|
|
public class SpectrumArrayContainer : ISpectrumArrayContainer, IUpdater
|
2019-09-29 19:53:47 +00:00
|
|
|
{
|
|
|
|
private readonly IPdArray[] arrays_;
|
2019-10-05 09:38:46 +00:00
|
|
|
private readonly IUpdater[] updaters_;
|
2019-09-29 19:53:47 +00:00
|
|
|
|
2019-10-04 13:35:23 +00:00
|
|
|
public SpectrumArrayContainer()
|
2019-09-29 19:53:47 +00:00
|
|
|
{
|
2019-10-05 09:38:46 +00:00
|
|
|
arrays_ = new IPdArray[PdConstant.NumMaxInputChannels];
|
|
|
|
updaters_ = new IUpdater[PdConstant.NumMaxInputChannels];
|
|
|
|
|
|
|
|
for (var i = 0; i < PdConstant.NumMaxInputChannels; ++i)
|
|
|
|
{
|
|
|
|
arrays_[i] = new PdArray("fft_" + i, PdConstant.FftSize);
|
|
|
|
updaters_[i] = (IUpdater) arrays_[i];
|
|
|
|
}
|
2019-09-29 19:53:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Update()
|
|
|
|
{
|
2019-10-05 09:38:46 +00:00
|
|
|
foreach (var updater in updaters_)
|
2019-09-29 19:53:47 +00:00
|
|
|
{
|
2019-10-05 09:38:46 +00:00
|
|
|
updater.Update();
|
2019-09-29 19:53:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public IPdArray this[int index] => arrays_[index];
|
|
|
|
}
|
|
|
|
}
|