public unsafe void updateData(Complex *c, int length) { FFTWComplex *id = (FFTWComplex *)_input; if (length != _bins) { Console.WriteLine("Warning! Reallocing SFFT!"); realloc(length); } for (int i = 0; i < length; i++) { id[i].imag = c[i].imag; id[i].real = c[i].real; } }
public unsafe void copyOutput(Complex *c, int length) { FFTWComplex *od = (FFTWComplex *)_output; if (length != _bins) { Console.WriteLine("Warning! Reallocing SFFT!"); realloc(length); } int middle = _bins / 2; // FFTW have DC (Zero-Frequency) at the left corner (od[0]). But the SDR Expects a symmetric FFT with the DC in the center. for (int i = 0; i < middle; i++) { // Lower c[i].imag = (float)od[middle + i].imag; c[i].real = (float)od[middle + i].real; // Upper c[middle + i].imag = (float)od[i].imag; c[middle + i].real = (float)od[i].real; } }