JUCE_VST3_CAN_REPLACE_VST2 issue in Studio One

In Studio One, parameters values are lost when switching between VST2 and VST3 versions of the same JUCE plugin.

The problem is in JUCE’s VST3 wrapper: it expects a ‘VstW’ header that Studio One doesn’t provide, whereas Cubase and Sonar do.

According to VST3 docs, ‘VstW’ is not part of the VST3 specification and therefore up to the host to add it to the chunk.

Here’s a quick and dirty patch to fix that:

void loadVST2Block (const char* data, int size)
{
    auto bank = (const vst2FxBank*) data;
    auto version = static_cast<int> (htonl (bank->version1)); ignoreUnused (version);
    
    jassert ('CcnK' == htonl (bank->magic1));
    jassert ('FBCh' == htonl (bank->magic2));
    jassert (version == 1 || version == 2);
    jassert (JucePlugin_VSTUniqueID == htonl (bank->fxID));
    
    setStateInformation (bank->chunk,
                         jmin ((int) (size - (bank->chunk - data)),
                               (int) htonl (bank->chunkSize)));
}

bool loadVST2CompatibleState (const char* data, int size)
{
    if (size < 4)
        return false;

    auto header = htonl (*(juce::int32*) data);
    
    if (header == 'VstW')
    {
        loadVST2VstWBlock (data, size);
        return true;
    }
    else if (header == 'CcnK')
    {
        loadVST2Block (data, size);
        return true;
    }

    if (memcmp (data, "VST3", 4) == 0)
    {
        // In Cubase 5, when loading VST3 .vstpreset files,
        // we get the whole content of the files to load.
        // In Cubase 7 we get just the contents within and
        // we go directly to the loadVST2VstW codepath instead.
        return loadVST3PresetFile (data, size);
    }

    return false;
}

bump :slight_smile:

Thanks! I’ll take a look at this now…

Hi Jules, did you fix this? I was still able to reproduce the issue in 5.4.5 in studio one. The transition from vst2 to vst3 does not work.
When i open a studio one session that includes vst2 versions of a plugin and i replaced it with a vst3 (that includes the vst2 with JUCE_VST3_CAN_REPLACE_VST2) then it shows “Plugin Not Found”.

Same works in bitwig studio.

I made some more tests. This was not the problem. Studio One does not find the vst3 for the given vst2 plugin. It never calls the methods above for the plugin.

Can someone reproduce this? What can i do to get this working?

Ok, found the issue. The plugin name (used for VST3) must fit the project name(used for VST2) to be compatible in studio one :frowning:

It’s not possible to change the plugin name anymore, because it’s already in production with that name. It looks that there is no solution for this. Let me know if anyone has an idea how this can be fixed.

Edit:
I submitted a bug report to the studio one team about this. I think they should use something like the plugin ID instead of the name to map the VST2 to the VST3 plugin. The plugin name is not the right way to do this because it works in other hosts also without a matching name.

1 Like