Accord.Audio.Windows.RectangularWindow.Apply C# (CSharp) Method

Apply() public method

Splits a complex signal using the current window.
public Apply ( ComplexSignal complexSignal, int sampleIndex ) : ComplexSignal
complexSignal ComplexSignal
sampleIndex int
return ComplexSignal
        public ComplexSignal Apply(ComplexSignal complexSignal, int sampleIndex)
        {
            Complex[,] resultData = new Complex[Length, complexSignal.Channels];
            ComplexSignal result = ComplexSignal.FromArray(resultData, complexSignal.SampleRate);

            int channels = result.Channels;
            int minLength = System.Math.Min(complexSignal.Length - sampleIndex, Length);

            unsafe
            {
                for (int c = 0; c < complexSignal.Channels; c++)
                {
                    Complex* dst = (Complex*)result.Data.ToPointer() + c;
                    Complex* src = (Complex*)complexSignal.Data.ToPointer() + c + channels * sampleIndex;

                    for (int i = 0; i < minLength; i++, dst += channels, src += channels)
                    {
                        *dst = *src;
                    }
                }
            }

            return result;
        }

Same methods

RectangularWindow::Apply ( Signal signal, int sampleIndex ) : Signal
RectangularWindow::Apply ( double signal, int sampleIndex ) : double[]
RectangularWindow::Apply ( double signal, int sampleIndex ) : double[][]