Plugins crashing on mono tracks

With JUCE 1.50, the setSpeakerArrangement function in the VST wrapper has been changed considerably compared to 1.46. Unfortunately, when inserted on mono tracks, the demo plugin now crashes in the process() subroutine as numInChans and numOutChans are not set to one. Hence I have changed the respective lines in setSpeakerArrangement to

speakerInChans = numInChans = pluginInput->numChannels; speakerOutChans = numOutChans = pluginOutput->numChannels;

which seems to have fixed the issue.

Thanks, I think that makes sense. I’m a little worried that it might have some unexpected side-effects, though I can’t actually see any problems with it.

Me neither… and with the previous version numInChans was always set to the maximum number of channels the plugin reported, so placing, say, a plugin with optional sidechain capabilities on a stereo track would produce a crash as well.
Actually, speakerInChans and speakerOutChans are effectively local variables in setSpeakerArrangement; might be better/cleaner to remove them altogether and use numInChans and numOutChans only?

Yes, I noticed that too. The speaker arrangement method has been revised quite a few times with suggestions from several people, which explains why it’s maybe not too elegant!

I have suggested some changes to the speaker arrangement some time ago in this post:
I am working with this code for months now and had never any problems with cubase, live, logic, sonar and other small test hosts on Win32 and Mac.
I’ve used random numbers of inputs and outputs with and without sidechains - everything worked fine.
(Even the problems with live that were mentioned at the end of the above post never occurred on mac and windows with live 7 and 8 with any In/Out config.)

So maybe it’s worth to give it a try.

I think I must have missed that post when you made it - looks like a good set of changes! I’ll take a look at it later today…

the setSpeakerArrangement method is still missing the assignment of the correct numbers to numInChans and numOutChans (pluginInput->numChannels and pluginOutput->numChannels).

Is this planned to be added?

The code seems to already do that:

numInChans = pluginInput->numChannels; numOutChans = pluginOutput->numChannels;


You are right, I was looking at the wrong file sorry ^_^’