| 345 | } |
| 346 | |
| 347 | Complex * SampleUtils::FFT(Complex * x, quint32 N) |
| 348 | { |
| 349 | Complex* out = new Complex[N]; |
| 350 | Complex* scratch = new Complex[N]; |
| 351 | Complex* twiddles = new Complex [N]; |
| 352 | quint32 k; |
| 353 | for (k = 0; k != N; ++k) |
| 354 | { |
| 355 | twiddles[k].real(cos(-2.0 * M_PI * k / N)); |
| 356 | twiddles[k].imag(sin(-2.0 * M_PI * k / N)); |
| 357 | } |
| 358 | FFT_calculate(x, N, out, scratch, twiddles); |
| 359 | delete [] twiddles; |
| 360 | delete [] scratch; |
| 361 | return out; |
| 362 | } |
| 363 | |
| 364 | Complex * SampleUtils::IFFT(Complex * x, quint32 N) |
| 365 | { |