[solved] How do I call a method from a GUI component from within the pluginprocessor?

Hi everybody!
Started using juce, all works fine, but 1 thing is buggin me for hours now…
I have nade an audioplugin and added a GUI component, and the correposneding audio dsp code is also in that GUI component, so that I can keep the functionality and the interface together.
The GUI component is ofcourse included in the plugineditor.
Now I want to call the audio dsp code from processblock.
I have added a typed pointer to the guicomponent in the processor, and I set that pointer from the editor, with a security check to prevent processor to call the unitialised pointer. But this crashes moslty.
I was searching in the processor for something like this in the pluginprocessor
myEditor.theExtraGUIthingy.theDSPfunction
but cant find it.
Thanks in advance!

Yes, that’s not how you do that. AudioPlugins need to be able to run with no editor open (that is 90% of the lifetime of a plugin).

Create your processing in the processor or other additional classes there. But don’t have them in the editor.

HTH

1 Like

thanks Daniel, I understand…
would have been nice to have gui elements with the DSP functions included, now I’ll have to split interface and functionality… that is way less convenient, but I’ll manage.

So you would want to force the user of the plugin to have to plugin window always open in order for the audio processing to work? (I can only think of one case when that would be reasonable, a visual analyzer plugin.)

You will appreciate later, that you had to split it up. There is a second reason, which is, that audio processing happens on a different thread and needs to be decoupled from any GUI interaction.
And it is easier that way, if there is only one class, where the GUI thread (MessageManager) meets the audio processing.

no, not for that reason. It was pure for the beauty of coding. but daniel is right.