I've noticed that VstPluginAudioProcessor and VstPluginAudioPrecisionProcessor are copying buffer values one by one. Since the pointers are already exposed, I suggest using Buffer.MemoryCopy():
using System.Runtime.Intristics;
using System.Runtime.Intristics.X86;
// ...
unsafe
{
float* inputBuffer = this.Buffer;
float* outputBuffer = ((IDirectBufferAccess32)destination).Buffer;
int i = 0;
if (Avx.IsSupported)
for (; i + 8 <= this.SampleCount; i += 8)
Avx.Store(outputBuffer + i, Avx.LoadVector256(inputBuffer + i));
if (Sse2.IsSupported)
for (; i + 4 <= this.SampleCount; i += 4)
Sse2.Store(outputBuffer + i, Sse2.LoadVector128(inputBuffer + i));
for (; i < this.SampleCount; i++)
{
outputBuffer[i] = inputBuffer[i];
}
}
And likewise for doubles, just divide the jumps by 2 (though a simple memory copy would be more useful in this case).
I've noticed that
VstPluginAudioProcessor
andVstPluginAudioPrecisionProcessor
are copying buffer values one by one. Since the pointers are already exposed, I suggest usingBuffer.MemoryCopy()
:Or SIMD, like so:
And likewise for doubles, just divide the jumps by 2 (though a simple memory copy would be more useful in this case).