AudioProcessorGraph in a VSTi Plugin

What is the correct way to use an AudioProcessorGraph in a VST plugin?

I have a standalone app which implements a processor graph which im trying to port over to a VSTi.
Ive tried the methods as described here and here and everything in between, but without success. Likely I am missing something obvious relating to the channel configuration.

My current setup is as per the second link above, its clear im getting a channel mismatch when calling AddNode on the graph.

JUCE Assertion failure in juce_audioprocessor.cpp:137

// the processor may not support this arrangement at all
jassert (newNumIns == getTotalNumInputChannels() && newNumOuts == getTotalNumOutputChannels());

Manual calls (within PrepareToPlay on the mainFilter) to setPlayConfigDetails on the Graph and myProcessor both work fine (input 0, output 2), but when adding a node to the graph getTotalNumInputChannels() and getTotalNumOutputChannels() always reads 0, which throws the Assertion when for example AudioGraphIOProcessor::audioOutputNode has an input of 2. Why are these returning 0?

Also in the links above and elsewhere ive seen people mention in a plugin context that you can use AudioProcessorPlayer, which sounds great, but is it true? Surely the player only works on devicemanager callbacks and wont work in a plugin? Can you hookup the callback within a plugin?

Of course my whole approach may be flawed in which case ignore everything under the first line, id just like it to work :slight_smile:

Ha! the issue was resolved here. Probably going mad but i searched these terms for ages without this thread popping up and now i see it everywhere, also I have the latest grapefruit juce and the fix doesnt seem to have promulgated.

This is also fixed on the experimental/multibus branch. One of the major reasons why the multibus API needed a revision was for use cases like the one you are doing.

Hi Fabian, thanks for the good work, ive not explored the new multibus system yet but its where im going with the project so will be diving in soon.

Ref this particular fix, i realise i got a little muddled about the implementation; i had assumed from jacques post that swapping arguments to input first was the fix itself, indeed its what worked for me, but i notice from github that this was the original state and youve amended it to have the output as the first argument?

Ive now noticed that AudioProcessorGraph only works with devicemanager using your edit (output,input,…), and only works in the Plugin using Jacques change (input,output,…), so for whatever reason it would seem both variations are required.

Glad to have helped :slight_smile: