Take samples from the end of the buffer

This commit is contained in:
Mike Walters
2016-07-30 18:43:43 +01:00
parent 39c15c93a9
commit 02eda1fd92

View File

@ -200,12 +200,12 @@ int rx_callback(hackrf_transfer* transfer) {
frequency = *(uint16_t*)&buf[2]; frequency = *(uint16_t*)&buf[2];
} }
/* copy to fftwIn as floats */ /* copy to fftwIn as floats */
buf += 4; buf += 16384 - (fftSize * 2);
for(i=0; i < fftSize; i++) { for(i=0; i < fftSize; i++) {
fftwIn[i][0] = buf[i*2] * window[i] * 1.0f / 128.0f; fftwIn[i][0] = buf[i*2] * window[i] * 1.0f / 128.0f;
fftwIn[i][1] = buf[i*2+1] * window[i] * 1.0f / 128.0f; fftwIn[i][1] = buf[i*2+1] * window[i] * 1.0f / 128.0f;
} }
buf = buf + 16380; buf += fftSize * 2;
fftwf_execute(fftwPlan); fftwf_execute(fftwPlan);
for (i=0; i < fftSize; i++) { for (i=0; i < fftSize; i++) {
// Start from the middle of the FFTW array and wrap // Start from the middle of the FFTW array and wrap