At first at all: does JUCE
timerCallback provide separate thread?
That’s why I am asking:
I created own plugin which calculates FFT Radix-2. I coded it as that in
processBlock I collect enough data to vector. When there is enough data collected, I block further collecting by
bool flag like
collectingData = false and set other
bool flag -
dataIsCollected. And in the mean time there is timer working and do nothing until
true. If it’s true in
timerCallback I calculate FFT. After FFT calculations I set
collectingData = true to allow
processBlock to collecting data again.
I separated it outside
processBlock to be sure signal workflow in
processBlock is not affected by FFT calculations for bigger buffer sizes like 32768. And it works, audio signal works without any lags.
But I found that twisting knobs or moving sliders in other plugins in the same process (for example Fabfilter Pro-Q2) are lagged. I wonder how to avoid that.
I found Voxengo SPAN analizer there is possible to set buffer size to 65536 (I am not sure but I suppose it’s buffer size for FFT), and it does not affect on performance in other plugins. Computer works as crazy, heating, and cooling fans roaring, but moving sliders or knobs work perfectly, with no lags. How to achieve that?
I thought my lags problem happens because I had to much points my
Path which I draw on screen. So for debug I turned off drawing at all. And it didn’t help.
So I thought maybe my timer is too fast. So in
timerCallback() I call
stopTimer then make FFT calculations, and after that I
startTimer again. To be sure, even if FFT is very slow (or very big buffer size)
timerCallback will not overlap between each call. But it also didn’t help.
Any tips? Please?