Hello, I’m pretty new to JUCE but I’ve started to create simple FFT spectrum analyser with it.
What I do is get buffered samples through FFTW, put them in bins (with some average value calculation) and then pass bin values to the editor like that:
EqualizerAudioProcessorEditor* editor = static_cast <EqualizerAudioProcessorEditor*> (getActiveEditor());
if(editor != NULL)
{
editor->DrawBins(bins);
}
First of all: Is it a good way of updating the visualization screen or is there any neater way of handling this?
Secondly, what’s the fastest way to draw those bins anyway. So far I do something like this:
gridImage = Image(Image::RGB, windowWidth, windowHeight, true);
Graphics g (gridImage);
int x = 0;
for(int i = 0; i < binsNum; i++)
{
g.fillRect(x, windowHeight, binWidth, bins[i]);
x += ioffset;
}
gridDrawable.setImage(gridImage);
I suppose this isn’t good way of drawing anything (so many initializations and stuff) but could anyone please help with this issue?
Thanks in advance.