Combine two juice audio plugins into one

Hi,

I have two JUCE Audio Plugins and I wanted to create a new third audio plugin that combines the functionality of the first two. What’s the best way to import the PluginProcessor.cpp/.h from the two old plugins into the new plugin? How should I setup the Projucer or the cmake project so I can instantiate both of the plugin processors and call processBlock for them from the new plugin’s processBlock?

Thanks!

I am afraid that you have to move the APVTS both processors to another main juce::AudioProcessor. Then you may do something like this in the main processor (for any relevant functions):

void prepareToPlay(...) {
    dsp1.prepareToPlay(...);
    dsp2.prepareToPlay(...);
}

void processBlock(...) {
    if (isDSP1ON().load()) {dsp1.processBlock();}
    else {dsp2.processBlock()};}
}

Of course you also need to handle the editor properly.

Ok thanks. How do you handle all the includes? Do you just include the other plugin processor in your project?

I am using CMake and I includes all .cpp and .hpp.

file(GLOB_RECURSE SourceFiles CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/source/*.hpp")
target_sources(SharedCode INTERFACE ${SourceFiles})

For simplicity you may remove the inheritance of juce::AudioProcessor from those two processors.

Edit: The juce::AudioProcessorGraph might be an easier solution. But I have never played with it before.

You can assign the processors to nodes on the audio-graph.

By placing the nodes in series, you can effectively combine existing processor classes.