2019-09-29 19:53:47 +00:00
|
|
|
namespace cylvester
|
|
|
|
{
|
2019-10-05 16:09:24 +00:00
|
|
|
public interface IPdArrayContainer
|
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 16:09:24 +00:00
|
|
|
public class PdArrayContainer : IPdArrayContainer, 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-05 16:09:24 +00:00
|
|
|
public PdArrayContainer(string prefix)
|
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)
|
|
|
|
{
|
2019-10-05 16:09:24 +00:00
|
|
|
arrays_[i] = new PdArray(prefix + i, PdConstant.BlockSize);
|
2019-10-05 09:38:46 +00:00
|
|
|
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];
|
|
|
|
}
|
|
|
|
}
|