Ejemplo n.º 1
0
        public double[] Filter(double[] inPcm)
        {
            var outPcm = new double[inPcm.Length];

            if (mParity == WWMath.WWParity.Odd)
            {
                int lastOffs = mHalfCoeffs.Length * 2 - 2;

                for (int pos = 0; pos < inPcm.Length; ++pos)
                {
                    double x = inPcm[pos];

                    mDelay.Filter(x);

                    double y = 0;
                    for (int i = 0; i < mHalfCoeffs.Length - 1; ++i)
                    {
                        y += mHalfCoeffs[i] * (mDelay.GetNthDelayedSampleValue(i)
                                               + mDelay.GetNthDelayedSampleValue(lastOffs - i));
                    }
                    y += mHalfCoeffs[mHalfCoeffs.Length - 1] * mDelay.GetNthDelayedSampleValue(mHalfCoeffs.Length - 1);

                    outPcm[pos] = y;
                }
            }
            else
            {
                int lastOffs = mHalfCoeffs.Length * 2 - 1;

                for (int pos = 0; pos < inPcm.Length; ++pos)
                {
                    double x = inPcm[pos];

                    mDelay.Filter(x);

                    double y = 0;
                    for (int i = 0; i < mHalfCoeffs.Length; ++i)
                    {
                        y += mHalfCoeffs[i] * (mDelay.GetNthDelayedSampleValue(i)
                                               + mDelay.GetNthDelayedSampleValue(lastOffs - i));
                    }

                    outPcm[pos] = y;
                }
            }

            return(outPcm);
        }
            public double Filter(double x)
            {
                double y = fg.Filter(x);

                delay.Filter(y);
                return(y);
            }
        public double [] Filter(double [] inPcm)
        {
            var outPcm = new double[inPcm.Length];

            for (long i = 0; i < outPcm.Length; ++i)
            {
                mDelay.Filter(inPcm[i]);
                outPcm[i] = Convolution();
            }
            return(outPcm);
        }