How to put the FFT into the Visualizer component to make a visualizer in frequency function

Hi.
I’m making an audio application that plays rose noise, what i need to do is to visualice the audio in function of the frequency and not in function of time. I already declare a class called Visualiser.

class Visualiser : public AudioVisualiserComponent
{
public:
    Visualiser() : AudioVisualiserComponent(2)
    {
        setBufferSize(512);
        setSamplesPerBlock(256);
        setColours(Colours::ghostwhite,Colours::darkblue);
    }
    
};

this is the header file.

I’m making visible and set some bound to the visualiser component.

/*
  ==============================================================================

    This file was auto-generated!

  ==============================================================================
*/

#include "MainComponent.h"

//==============================================================================
MainComponent::MainComponent() : AudioAppComponent(otherDeviceManager) ,state(Parado), cargarButton("Cargar"), reproducirButton("Reproducir"), pararButton("Parar")
{
    
    otherDeviceManager.initialise(4, 2, nullptr, true);
    audioSettings.reset(new AudioDeviceSelectorComponent(otherDeviceManager,0,4,0,2,true,true,true,true));
    addAndMakeVisible(audioSettings.get());
    
    setAudioChannels (4, 2);
    
    cargarButton.onClick = [this] {cargarClicked();};
    cargarButton.setColour(TextButton::buttonColourId, Colours::darkgoldenrod);
    addAndMakeVisible(& cargarButton);
    
    reproducirButton.onClick = [this] {reproducirClicked();};
    reproducirButton.setColour(TextButton::buttonColourId, Colours::darkgoldenrod);
    reproducirButton.setEnabled(true);
    addAndMakeVisible(& reproducirButton);
    
    pararButton.onClick = [this] {pararClicked();};
    pararButton.setColour(TextButton::buttonColourId, Colours::darkgoldenrod);
    pararButton.setEnabled(false);
    addAndMakeVisible(& pararButton);

    formatManager.registerBasicFormats();
    transport.addChangeListener(this);
    
    addAndMakeVisible(visualiser);
    
    setSize (800, 700);
    
}

MainComponent::~MainComponent()
{
    // This shuts down the audio device and clears the audio source.
    shutdownAudio();
}

//==============================================================================
void MainComponent::prepareToPlay (int samplesPerBlockExpected, double sampleRate)
{
    
    transport.prepareToPlay(samplesPerBlockExpected, sampleRate);
    
    visualiser.clear();
}

void MainComponent::getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill)
{
    
    bufferToFill.clearActiveBufferRegion();
    transport.getNextAudioBlock(bufferToFill);
    
    visualiser.pushBuffer(bufferToFill);
    
}

void MainComponent::releaseResources()
{
    // This will be called when the audio device stops, or when it is being
    // restarted due to a setting change.

    // For more details, see the help for AudioProcessor::releaseResources()
}

//==============================================================================
void MainComponent::paint (Graphics& g)
{
    // (Our component is opaque, so we must completely fill the background with a solid colour)
    g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));

    // You can add your drawing code here!
}

void MainComponent::cargarClicked()
{
    FileChooser chooser("Seleccione el archivo de audio que desea cargar WAV o AIFF",File::getSpecialLocation(File::userDesktopDirectory),"*.wav ;*.aiff ;*.mp3");
    
    if (chooser.browseForFileToOpen()){
        File myfile;
        myfile = chooser.getResult(); //Lee el dato que escogio el usuario
        
        AudioFormatReader* reader = formatManager.createReaderFor(myfile); //Escribe los datos de Audio en una variable
        if (reader != nullptr)
        {
            std::unique_ptr<AudioFormatReaderSource> tempSource (new AudioFormatReaderSource(reader, true));
            transport.setSource(tempSource.get());
            transportStateUpdate(Parado);
            playSource.reset(tempSource.release()); // Prepara el audio para reproducirse
            
        }
        
        
        
    }
}

void MainComponent::resized()
{
    
    cargarButton.setBounds(20, 20, 300, 50);
    reproducirButton.setBounds(20, 80, 300, 50);
    pararButton.setBounds(20, 140, 300, 50);
    audioSettings->setBounds(20, 220, 300, 250);
    visualiser.setBounds(340, 20, 300, 200);
    
}

void MainComponent::reproducirClicked()
{
    transportStateUpdate(Reproduciendo);
    
}

void MainComponent::pararClicked()
{
    transportStateUpdate(Parando);
    
}

void MainComponent::transportStateUpdate(TransportState newState)
{
    if (newState != state)
    {
        state = newState;
        switch (state) {
            case Parado:
                reproducirButton.setEnabled(true);
                transport.setPosition(0.0);
                break;
            
            case Sonando:
                reproducirButton.setEnabled(false);
                pararButton.setEnabled(true);
                break;
            
            case Reproduciendo:
                pararButton.setEnabled(true);
                reproducirButton.setEnabled(false);
                transport.start();
                break;
                
            case Parando:
                reproducirButton.setEnabled(true);
                pararButton.setEnabled(false);
                transport.stop();
                break;
                
        }
    }
}

void MainComponent::changeListenerCallback(ChangeBroadcaster *source)
{
    if (source = &transport)
    {
        if (transport.isPlaying())
        {
            transportStateUpdate(Sonando);
        }
        else
        {
            transportStateUpdate(Parado);
        }
    }
}

I don’t think you should inherit AudioVisualiserComponent. If you want a frequency display, you will need to implement that from scratch. You don’t appear to have anything in the code that would analyze frequencies, to begin with.