What to do with cpp & h files from the jucer?


#1

Hi,
it can sound as a strange question.

But if I understand the fact we can easily design components with the Jucer, export resulting cpp & h, how can I “call” the component to use it in my main code ?

More, I saw that the audio plugin code provided as extras with juce lib as been "autogenerated by jucer"
Does it mean the basic starting point could be the jucer, and then by altering the code we add dsp part etc ?

any infos or experiencies would be appreciated.


#2

With an audio plugin, in your editor class (usually Editor.cpp or something like that) you just include the .h file for starters (#include “MyComponent.h”).

When you generate a component with the jucer, it includes “juce.h” by default and you have to change this to whatever path your plugin is using. So find that in your editor class (something like “…/juceheaders.h”, can’t remember exactly) and use that instead. Now everything should compile ok.

In the editor, just do “addAndMakeVisible( new MyComponent )” in it’s constructor and you should see it in your editor GUI when you load the plugin now (it’s good to test the in PluginHost application also).

From there you can add more components into that until you have a fully fledged GUI. If you want the GUI to talk to your DSP code, you’ll have to pass a pointer to the AudioProcessor to “MyComponent”.


#3

Anima, MANY thanks.
I got it.
I just have to test & play with that.

Do you use the jucer for all part ?
I mean, I could create a pool of component using the jucer and then include this one or that one as you wrote (.h) and then… addAndMakeVisible them.

More, about hierarchy.
It would be very nice for me to create for instance one component per panel in my whole design.
and then, to include all panels in one component, etc etc
I’d make that later, when I’ll be ok with one component :smiley:


#4

[quote=“Anima”]With an audio plugin, in your editor class (usually Editor.cpp or something like that) you just include the .h file for starters (#include “MyComponent.h”).

When you generate a component with the jucer, it includes “juce.h” by default and you have to change this to whatever path your plugin is using. So find that in your editor class (something like “…/juceheaders.h”, can’t remember exactly) and use that instead. Now everything should compile ok.

In the editor, just do “addAndMakeVisible( new MyComponent )” in it’s constructor and you should see it in your editor GUI when you load the plugin now (it’s good to test the in PluginHost application also).

From there you can add more components into that until you have a fully fledged GUI. If you want the GUI to talk to your DSP code, you’ll have to pass a pointer to the AudioProcessor to “MyComponent”.[/quote]

I’m still stuck, and this isn’t because I’m not making effort in that (probably because those efforts aren’t in the good direction)

Today, I guess my best way to customize UI is to start from the Audio Plugin demo & to do what you adviced.
BUT

I included the NewComponent.h in the pluginEditor.h (I even tested in the plugProcessor.h)
I changed the path to juce.h
I made a nice extra panel in the jucer.
I made an addAndMakeVisible to the new component in the editor constructor BUT it doesn’t appear.

I didn’t tested the pointer passed because I’m a bit confuse with it.

Would you help me with these 2 points ?


#5

Well I think it would be better to start from scratch and learn how things work that way. You’re going to end up deleting a lot of code now.

First thing in PluginEditor.h

should be

In pluginEditor.cpp you should have some code to resize your component, like

In NewJucerComponent.h

should be

Thats all I spotted anyways, just make sure you include the VST library when compiling