I’m saying sorry in advance because I’m asking tonnes of questions that probably seem obvious to seasoned C++ coders and Juce users.

I’ve been playing around with the plugin in host demo today. It’s fantastic. I’m working through the code and slowly starting to understand how it all works. It’s great because I can instantiate sound generator and effect VSTs within the app. Now, I want to create an ADSR, or LFO modulator, display it in the FilterGraph, and create the necessary components using the STK. I want to connect the modulator up to a VST to modulate some parameter.

I’m going to use Dave96’s STK wrapper here: .I’ve already got this module included in my project.

So, my general question is: are there any tips to how I would go about creating a graph class to display the ADSR/LFO? The existing class for plugins/midi in/out etc. is AudioProcessorGraph. Should create a new class which is like AudioProcessorGraph? Extend/alter AudioProcesserGraph? An ADSR doesn’t technically process audio so not exactly sure what to do here.

Any tips to point me in the right direction would be great. Anything at all.

Apologies if I misunderstood your post, but none of the audio ‘graph’ classes in JUCE have anything to do with plugin GUIs. They are so named because they form part of an actual processing graph.

In order to display an envelope just create your own custom component and draw the graph onto it using its paint() method. You’ll find it’s not too tricky.

Rory, thanks for this reply. I don’t get many opportunities to spend time on this so there’s long gaps in when I can post.

I’m still coming to terms with the terminology. I now understand that “Component” refers to a UI item. I’m referring to Plugin Host Demo. If you look at the FilterGraph class, you will see a “addFilter” method. Now, this method accepts a PluginDescription argument. So, my guess is that this refers to the description of a VST or whatever. In fact the addFilter method calls createPluginInstance(). This all looks pretty straight forward.

But, what I’m getting confused about is how the other nodes (non-plugin nodes) are getting drawn on the screen. addFilter seems to be the only method there but it only draws plugins. Can you point me to the sections of the code where the other components are created? E.g. Midi Input etc.

I can try to explain it! All filters, both internal and external are being added to the graph with the same addFilter() method. The first thing MainHostWindow::addPluginsToMenu() does (when activated by a right click on the main graph panel) is add the internal filters to the popup menu. After this it goes on to add all the KnownPlugins to the menu(this is why the internal filters are always listed first on the popup menu). All the filter are added to the popup menu by name. When a user clicks on the menu to add an internal or external filter GraphEditorPanel::createNewPlugin() gets called. The first parameter to this function, getChosenType ®, is passed the popup menu ID. It returns a PluginDescription for the chosen plugin. The plugin descriptor therefore gets passed to createNewPlugin() which in turn calls addFilter, which adds the corresponding filter to the main graph editor on screen.

For a clearer idea of what is happened try placing breakpoints on all those above mentioned functions. That will give you the clearest picture of how it works.

1 Like