Пример #1
0
        /*
         *
         * User-callable function to allocate all necessary storage space for the fft.
         *
         * The return value is a contiguous block of memory, allocated with malloc.  As such,
         * It can be freed with free(), rather than a kiss_fft-specific function.
         * */
        protected void kiss_fft_alloc(int nfft, bool inverse_fft)
        {
            Twiddles = new kiss_fft_cpx <kiss_fft_scalar> [nfft];

            int i;

            Nfft    = nfft;
            Inverse = inverse_fft;

            for (i = 0; i < nfft; ++i)
            {
                const double pi    = 3.141592653589793238462643383279502884197169399375105820974944;
                double       phase = -2 * pi * i / nfft;
                if (Inverse)
                {
                    phase *= -1;
                }

                Twiddles[i] = A.Exp(phase);
            }


            kf_factor(nfft, new Array <int>(Factors));
        }