AudioVisualiserComponent not working

Hi guys,

I am trying to draw a real time waveform using the AudioVisualiserComponent class.
I have a class which is inheriting from AudioVisualiserComponent.

But when I try to call a function from this class (like clear() or pushSample()), the plugin crashes.
I have no idea why…

Can anyone help me?


Why do you inherit from AudioVisualiserComponent?

So that I can use it as a component to draw a waveform.

AudioVisualiserComponent does not need to be inherited from in order to be used. It doesn’t have any pure virtual methods that you would be forced to override. Can you show your code?

Oke, do you recommend to not inherit from it?

I am using a standard component template from Juce where my ‘WaveForm’ class is inheriting with ‘class WaveForm : public AudioVisualiserComponent’

In my constructor of the waveform class I have this:
’ setSize (600, 180);

1 Like

Yeah, don’t inherit from it. Add it as a child component to some parent component.

Thank you. Now, this is working better. No errors and a correct white background color.

Only… no waveform showing up.
I use this to push samples (where lastInputBuffer is the latest input buffer):
if (waveForm!=nullptr){
for(int i = 0;i<256;i++){
waveForm->pushSample(&lastInputBuffer[i], 1);

Did you do addAndMakeVisible on the visualizer component and did you also set its bounds? Where in your code are you doing that sample pushing? Also, why are you constantly clearing the visualizer?

I did the addAndMakeVisible and it is showing the white background color.
I also set its bounds.
My sample pushing is in the process function in my AudioProcessor.
I’m clearing the visualizer so that I can draw a new waveform.

Still, 50% of the times, the plugin crashes when I load it in my DAW

You are probably not handling your plugin GUI correctly. Plugins should be coded so that the GUI never has to even exist and they must tolerate the GUI being destroyed without warning etc.

hey i recently streamed some experimentation with the audiovisualisercomponent. The problem initially was that the AVC worked perfectly fine for me in the audio application but didnt work when i had to share the object in the Audio Plugin version. All i had to do in the end was have an AVC in the processor to push buffers etc, and in the editor i made a copy of the object through a reference and set things like bounds and visibility.

if it helps you watching the stream you can do so here (from 0 to about 55 mins in, at 50 mins i got it working):

initially my problem sounds the same to yours, just that the 2 components arent properly linked. :slight_smile:

Hey Skytrias, the Twitch link is dead! Would love to have a look if you still have the video :slight_smile: