Creating an internal plugin for Plugin Host example


#1

Good evening gentlemen!

I’m a beginner in JUCE development as I just recently found the library. I have been poking around the examples and API docs as well as other references on the internet for a while now, but even some basic concepts still seems rather hard to grasp on the actual code level.

The exact case is pretty much this: https://forum.juce.com/t/add-audio-file-player-node-for-plugin-host-example/17125/7
And what I have done is this: https://forum.juce.com/t/how-to-inherit-from-audioplugininstance/13046/6

…but to no avail. When I inherit that class and create dummy bodies for the needed methods and get things to build, the plugin host still does not like what I’ve done and refuses to initialize the plugin like this:

What is it that needs to be done for me to be able to write internal plugins (as in not vst/au) inside the Plugin Host example that can be actually initialized in a proper manner? I’d guess extending the AudioProcessorGraph::AudioGraphIOProcessor class is not an option since it seems to be directly connected to the audio hardware, and I’d just like to create a simple internal generator that just has a stereo output and nothing else. I’d guess the proper way would be to extend AudioProcessor class directly, but how can it be initialized when the required type is a pointer to AudioPluginInstance class? Or am I looking the wrong way when I try to implement this the same way as the InternalFilters has been implemented?


#2

Not sure you need to inherit from AudioPluginInstance, just inherit from AudioProcessor and add that processor to the AudioGraph.


#3

I was able to figure this out inheriting directly from AudioGraph, but it required some small changes to the FilterGraph.cpp. Mainly I added a new method for adding inherited AudioProcessors directly to the graph, which is copied from addFilterCallback:

void FilterGraph::addNode (AudioProcessor* processor, double x, double y)
{
    AudioProcessorGraph::Node* node = graph.addNode (processor);
    
    if (node != nullptr)
    {
        node->properties.set ("x", x);
        node->properties.set ("y", y);
        changed();
    }
}

This however breaks the saving and loading of the custom node settings. However it is a minor problem, as trying to figure out how to fill the PluginDescription properly so that the graph would find the actual AudioPluginInstance/AudioProcessor seems to be a pain in the ass.

Anyway, thanks for the tip! This will move things forward for me enough for now!