I’ve been trying to get started with writing a plugin using an AudioProcessorGraph connecting a number of my own AudioProcessor. But without success…
It all started from the Introjucer (4.1) to create a plugin, I replaced the default plugin AudioProcessor (in PluginProcessor.cpp/h) by an AudioProcessorGraph. I removed the original override of processBlock. And I added the graph constructions commands into the prepareToPlay function to simply connect the inputs to the outputs:
In PluginProcessor.h: class MyAudioProcessorGraph: public AudioProcessorGraph
In PluginProcessor.cpp: void MyAudioProcessorGraph::prepareToPlay (double sampleRate, int samplesPerBlock) { clear();
inProc = new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode); inNode = addNode(inProc);
outProc = new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode); outNode = addNode(outProc);
I don’t have any compilation error (debug mode), but when the plugin gets instantiated by the JUCE audio plugin host, it stops at this jassert. Which I don’t understand why. // the processor may not support this arrangement at all jassert (newNumIns == getTotalNumInputChannels() && newNumOuts == getTotalNumOutputChannels());
I must be doing something silly, any ideas?
EDIT:
value for newNumIns is 0 and getTotalNumInputChannels() returns 1
Maybe start by NOT inheriting from AudioProcessorGraph. It’s not designed to be a base class, and as soon as you override the methods that it needs to do its job, you’re going to break things!
Hmm, same problem
Now I have: class MyAudioProcessor : public AudioProcessor
In its constructor I call: graph = new AudioProcessorGraph();
Then in prepareToPlay void MyAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) { // Use this method as the place to do any pre-playback // initialisation that you need..
inProc = new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode);
inNode = graph->addNode(inProc);
[…] }
and it triggers the same error (jassert) calling this addNode(inProc).
I created a new project from scratch, with the same end result…
Read the MultiBus sticky thread. It’s a bug introduced with JUCE 4.1 and has meant I can’t update past JUCE 4.0 until it’s fixed. Hopefully it’s on the radar…
Sorry, really struggling to understand what exactly your problem is. Might be something that Fabian recognises from the multibus work, but he’ll be away and busy for the next week.
The new MultiBus configuration isn’t propagated down to the AudioProcessorGraph – I posted a modified version of the synth demo from JUCE 4.1 to demonstrate the issue in the other thread.