AudioProcessor #ifdefs are problematic

Working on a plug-in that contains an AudioProcessorGraph and of course AudioGraphIOProcessors to get Audio in and out of the graph. If the plug-in is an effect things work as expected but I encountered some strange behaviour when I changed the plug-in to be a synth. I found that the graph’s output node did not have any inputs (it was triggering an assertion). On close inspection of the AudioProcessor class it seems there are 16 #ifdef statements in the constructor that refer to plug-ins, and because this audio processor was inside a synth plug-in its buses were affected by the global #ifdef JucePlugin_IsSynth.

I think it would be much better if AudioProcessor did not use plugin related #ifdefs like this, which assumes any AudioProcessor in a plugin is always a plugin’s main AudioProcessor. Perhaps these options could be passed in as arguments to the constructor instead - with sensible defaults?

2 Likes

+1

I agree, I posted a few days ago with the same issue. When using a processor with some subprocessors inside it (like a synth, with some effects), all the effects ins/outs now get messed up.

+1
AudioProcessor is a general purpose class, shouldn’t contain any macros.

1 Like

The stuff in there is just a fallback to maintain compatibility with pre-multibus code. We’ll remove it all eventually when everyone has had time to update their bus configuration code.

Yes i know, but the fallback isn’t working. And if a fallback creates new bugs, its not a fallback, its a bug. Sorry

2 Likes

From the “plugin bus guide”

DISCLAIMER: If your plug-in does not require sidechain inputs or aux outputs or does not depend on the exact layout of the audio channels (i.e. your plug-in does not care if six channel audio is 5.1 surround, 6.0 surround or hexagonal audio) then it is easiest to use the PlugIn Channel Configuration field in the Introjucer.

If you read this, it doesn’t look like a fallback

3 Likes

i’m hosting plugins inside a plugin too and allow broken backwards compatibility with a buggy implementation was a terrible idea

The multibus guide doesn’t state anywere that we should update our code if we are not using multiple busses. On the contrary, it tells to use the old #defines for all projects with simple bus layouts.
I think you should change the wording if you want to encourage people to make the transition.

+1

Either we are all required to switch to multibus configuration or this is a critical bug.

1 Like

Thanks guys. This is something Fabian will need to look into - he’s away this week but will make sure he investigates as soon as he’s back.