Audio Application - MainComponent() initialization

Hello,
I would like to ask that:
I have created app from template Audio Application. And I have there class MainComponent() with empty constructor, just { }. And I have my own class AnalyserGraph(AudioBuffer<float> &) which as you can see to construct need AudioBuffer<float> &outputBuffer. I want to create in MainComponent variable of my type. But I need to initialise in some way the constructor. Don’t know how. I see the method getNextAudioBlock uses const AudioSourceChannelInfo& but not sure how to transfer/send it to initialisation of my class.
Of course I can create my variable in the getNextAudioBlock but then creation will happen every buffer (I mean very often), and I want to avoid that due to fact my class will perform FFT calculations. Also I want to hav access to variable of my class in the whole MainComponent class.
Could anyone help me? Or give some advice, also I suppose my goal should be solve in other way. And my gole is to perform FFT on the buffer data and graph it in the some kind of display.

Let your AnalyserGraph have its own internal buffer, there probably isn’t any reason to give the buffer to it from the outside. Then have some method in the AnalyserGraph that is used to push audio samples into the internal buffer. You could look for inspiration in the API of JUCE’s AudioVisualiserComponent.