protected override void ProcessFilter(Signal sourceData, Signal destinationData)
{
SampleFormat format = sourceData.SampleFormat;
int channels = sourceData.Channels;
int length = sourceData.Length;
if (format == SampleFormat.Format32BitIeeeFloat)
{
unsafe
{
float* src = (float*)sourceData.Data.ToPointer();
float* dst = (float*)destinationData.Data.ToPointer();
for (int i = 0; i < length * channels; i++, src++, dst++)
{
*dst = Volume * (*src);
}
}
}
else if (format == SampleFormat.Format16Bit)
{
unsafe
{
short* src = (short*)sourceData.Data.ToPointer();
short* dst = (short*)destinationData.Data.ToPointer();
for (int i = 0; i < length * channels; i++, src++, dst++)
{
*dst = (short)(Volume * (*src));
}
}
}
else if (format == SampleFormat.Format32Bit)
{
unsafe
{
int* src = (int*)sourceData.Data.ToPointer();
int* dst = (int*)destinationData.Data.ToPointer();
for (int i = 0; i < length * channels; i++, src++, dst++)
{
*dst = (int)(Volume * (*src));
}
}
}
}