···335335#else
336336337337 kiss_fft_cpx out[FFT_SIZE + 1];
338338- kiss_fftr(fftcfg, sampleBuf, out);
338338+ // Use the newest samples for FFT (they're at the end of the buffer)
339339+ kiss_fftr(fftcfg, sampleBuf + AUDIO_BUFFER_SIZE - (FFT_SIZE * 2), out);
339340340341 float peakValue = fPeakMinValue;
341342 for (int i = 0; i < FFT_SIZE; i++)
+5-3
src/ext/vqt.c
···263263 // Copy audio data from the shared buffer
264264 // sampleBuf is defined in fft.c as extern
265265 extern float sampleBuf[];
266266- memcpy(vqtAudioBuffer, sampleBuf, VQT_FFT_SIZE * sizeof(float));
266266+ // Use the newest samples for VQT (they're at the end of the buffer)
267267+ #define AUDIO_BUFFER_SIZE (VQT_FFT_SIZE > (FFT_SIZE * 2) ? VQT_FFT_SIZE : (FFT_SIZE * 2))
268268+ memcpy(vqtAudioBuffer, sampleBuf + AUDIO_BUFFER_SIZE - VQT_FFT_SIZE, VQT_FFT_SIZE * sizeof(float));
267269268270 // Check if we have any audio data
269271 float audioSum = 0.0f;
···317319 // Print profiling info every 60 frames (~1 second)
318320 if (profileCount % 60 == 0)
319321 {
320320- printf("VQT Performance (16K FFT):\n");
322322+ printf("VQT Performance (8K FFT):\n");
321323 printf(" FFT avg: %.3fms\n", totalFftTime / profileCount);
322324 printf(" Kernels avg: %.3fms\n", totalKernelTime / profileCount);
323325 printf(" Total avg: %.3fms\n", (totalFftTime + totalKernelTime) / profileCount);
···475477double tic_api_vqtr(tic_mem* memory, s32 bin) { return 0.0; }
476478double tic_api_vqtrs(tic_mem* memory, s32 bin) { return 0.0; }
477479478478-#endif // TIC80_FFT_UNSUPPORTED480480+#endif // TIC80_FFT_UNSUPPORTED