protected unsafe override void ProcessFilter(Signal sourceData, Signal destinationData)
{
SampleFormat format = sourceData.SampleFormat;
int channels = sourceData.Channels;
int length = sourceData.Length;
if (Channel < 0 || Channel > channels)
throw new InvalidOperationException("The signal doesn't contains the specified channel.");
if (format == SampleFormat.Format32BitIeeeFloat)
{
float* src = (float*)sourceData.Data.ToPointer() + Channel;
float* dst = (float*)destinationData.Data.ToPointer();
for (int i = 0; i < length; i++, src += channels, dst++)
*dst = *src;
}
else if (format == SampleFormat.Format16Bit)
{
short* src = (short*)sourceData.Data.ToPointer() + Channel;
short* dst = (short*)destinationData.Data.ToPointer();
for (int i = 0; i < length; i++, src += channels, dst++)
*dst = *src;
}
else if (format == SampleFormat.Format32Bit)
{
int* src = (int*)sourceData.Data.ToPointer() + Channel;
int* dst = (int*)destinationData.Data.ToPointer();
for (int i = 0; i < length; i++, src += channels, dst++)
*dst = *src;
}
}
}