AudioVisualiserComponent not working


#1

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?

Thanks!


#2

Why do you inherit from AudioVisualiserComponent?


#3

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


#4

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?


#5

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);
setRepaintRate(100);
setSamplesPerBlock(256);
setBufferSize(256);
setColours(Colours::white,Colours::black);
setNumChannels(1);’


#6

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


#7

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){
waveForm->clear();
for(int i = 0;i<256;i++){
waveForm->pushSample(&lastInputBuffer[i], 1);
}
}


#8

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?


#9

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


#10

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.


#11

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): https://www.twitch.tv/videos/139331635

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