Jassert (insideVSTCallback == 0);

I’m getting an assert about insideVSTCallback not being zero.

So I look in juce_VSTPluginFormat.cpp and here’s what I find:

static int insideVSTCallback = 0;

Huh? Does this mean that I can’t create several instances of the same VST plugin and call them each from a different thread simultaneously?

I was hoping to move the creation/deletion of VST plugins into its own thread rather than the audio processing thread because I have noticed that some VSTs have a costly load time (I’m getting some stuttering and pausing). But doing so means that it is possible for two different VST instances to be in the VSTPluginInstance::dispatch() function, and that apparently is not allowed.

Is this a Juce limitation or is this how the Steinberg API works?

The assert that always seems to go off for me is this one:

VSTPluginInstance::~VSTPluginInstance()
{
    const ScopedLock sl (lock);

    jassert (insideVSTCallback == 0);
    //....

Ah, that was an old assertion that was designed to stop idle() calls becoming re-entrant, but I guess it’s not very thread-smart (VST hosts have never historically done a lot of multi-threading). You can disable or ignore it for now, TBH I don’t think it’s particularly useful anyway.

should I comment out just that one line, or every jassert involving insideVSTCallback ?

I’d say just zap the one that’s causing you trouble. I’ll make a note to have another look at that value and have a bit of a re-think about it.

I’ve been banging on VSTs for a while now and the only assert that goes off is the one in ~VSTPluginInstance(), jassert (insideVSTCallback == 0);. Plugins are no more or less stable with or without the line (I’m using free VST effects so you can imagine the crap I’m dealing with). So far I have not seen it actually point out a real problem.