public unsafe void ReadToBuffer(byte[] src, int offset, float[] window, FFTW.Complex *dest) { int n = window.Length; fixed(void *srcptr = &src[offset]) { short *srcf = (short *)srcptr + Channel; for (int i = 0, j = 0; i < n; i += 1, j += ChannelCount) { dest[i].Real = srcf[j] * window[i] / 32768f / 100; //TODO why this affects the result? } } }
public unsafe void ReadToBuffer(byte[] src, int offset, float[] window, FFTW.Complex *dest) { int n = window.Length; fixed(void *srcptr = &src[offset]) { float *srcf = (float *)srcptr + Channel; for (int i = 0, j = 0; i < n; i += 1, j += ChannelCount) { dest[i].Real = srcf[j] * window[i] / 100; dest[i].Imaginary = 0; } } }