IPluginCompatibility: the function is never called

Hello,
I’m trying to implement the IPluginCompatibility function accordingly to the VST3 documentation.
My problem is that the static createCompatibilityInstance function seems to be never called even if a third class is added in the BEGIN_FACTORY_DEF.

BEGIN_FACTORY_DEF (…)

DEF_CLASS2 (INLINE_UID_FROM_FUID(PlugInCompatibilityUID),
PClassInfo::kManyInstances, // cardinality
kPluginCompatibilityClass, // for VST2 to VST3 compatibility
stringPluginName, // here the Plug-in name (to be changed)
0, // not used here
“”, // Subcategory for this Plug-in (to be changed)
FULL_VERSION_STR, // Plug-in version (to be changed)
kVstVersionString, // the VST 3 SDK version (dont changed this, use always this define)
createCompatibilityInstance) // function pointer called when this component should be instanciated

END_FACTORY

I checked within the Cubase Pro Module Cache.xml file and this third class (“Plugin Compatibility Class”) is there, just after the “Audio Module Class” and the “Component Controller Class”.

I’m quite sure this createCompatibilityInstance function is not call because I put some code which would crash Cubase (I didn’t trust the break point for that confirmation) and Cubase would load the VST3 plug-in without any problem.

Did I miss something ?
Thanks in advance for your help.

Best regards
Xavier

Cubase does not use this directly. Only the vstscanner is using it. Run vstscanner -p PATH_TO_YOUR_VST3_PLUGIN.

Thanks for your answer, Arne,

I still don’t understand. Running vstscanner works, outputting the three classes in the classInfos,.

But the static createCompatibilityInstance function, seems not to be called either: in this function, I put some code which would crash which doesn’t happen as the other createInstance do ( for the controller and processor)

So I still can’t find when and where this function is called.

Best regards
Xavier

This is only supported with Cubase 12.0.20 and later. You may have an earlier version?

Hi Arne,
Cubase 12.0.70 running here.

I did that:

    static FUnknown* createInstance (void*)
    {
char Test[128];

        int i = 200;
        for (i= 0; i< 8192; i++)
            Test[200-i] = 0xFFFF0D;

        return (IEditController*)new PlugInController ();
        
    }

Obviously Cubase crashes.

Then

static Steinberg::FUnknown* createCompatibilityInstance (void* context)
    {
char Test[128];

        int i = 200;
        for (i= 0; i< 8192; i++)
            Test[200-i] = 0xFFFF0D;

     return (Steinberg::IPluginCompatibility*)new PluginCompatibility;
        
    }

And Cubase doesn’t crash.

So I wonder about this function.

Best regards
Xavier

Because Cubase itself does not instantiate the IPluginCompatibility class, only the vstscanner does it. And it only does it, if you don’t have a moduleinfo.json file in your bundle.

OK, I understand about Cubase.
No moduleinfo.json in the bundle, a vstscanner dated 2016 (maybe a more recent is available, but I can’t find it).
Still, vstscanner output is correct (about the plug-in’s data), but it seems not calling the functions referenced in the field “gPluginFactory->registerClass (&componentClass,createMethod);” // function pointer called when this component should be instantiated

Why Am I puzzling with this is because I can’t make NKS looking for the VST3 plug-in instead of the VST2, but can’t fid the reason (every UUID seem correct). All I can think is that NKS can’t find the PluginCompatibility function for some reason (maybe an obvious C++ thing or something else I missed)

Ah OK, you’re using a wrong vstscanner version. You must use the one that is coming with Cubase. On macOS you will find it at /Applications/Cubase 12.app/Contents/Components/vstscanner

Thanks Arne,
OK, That helps a lot as I’m now sure that this function is called, even there is not compatibility with a previous VST2 plug-in (creating a project with the VST2, saving it, removing the VST2 and loading it again, especting the VST3 to be used).

VST2: ‘iPoM’ name PolyM
UUID (using convertVST2UID_To_FUID, with name in lowercase): 56535469506F4D706F6C796D00000000

VST3 (processor): 0xdf00b0a9, 0x8cb84005, 0x9b93f29e, 0x19f9e582

In the stream, I’m writing this:
“[ { "New": "DF00B0A98CB840059B93F29E19F9E582", "Old": [ "56535469506F4D706F6C796D00000000", ], } ]”

Best regards
Xavier

You can check if you used the correct VST2 UID by looking it up in /Users/$USERNAME/Library/Preferences/Cubase 12/Vst2xPlugin Infos Cubase.xml

thanks, indeed it’s the correct UUID
So I still don’t understand why NKS or cubase can’t launch the VST3 and reprt the VST2 missing.
Anyway, I’ll dig deeper.

Thanks

I think the general developer workflow to test this is:

  • Create a Cubase project that references the VST2 version
  • Quit Cubase
  • Delete the vst2 plug-in
  • Relaunch Cubase
  • Load the Cubase project

If that fails to exchange the VST2 plug-in then make sure that:

  • Cubase does not know the VST2 version by checking the VST Plugin-Manager inside Cubase.
  • The UID’s are correct by checking /Users/$USERNAME/Library/Preferences/Cubase 12/Vst2xPlugin Infos Cubase.xml for the VST2 UID and /Users/$USERNAME/Library/Preferences/Cubase\ 12/Cubase\ Pro\ VST3\ Cache/vst3plugins.xml for the VST3 UID.

Hi Arne,

First thanks a lot for your help.
After checking, double checking and doubted everything, with vstcanner, I was able to find it was simple my writing in the stream which wasn’t correct (too many bites were written).

With this fixed, Komple Kontrol works fine (replacing the VST2.5 by the VST3), but not Cubase 12.0.70 even I follow exactly what you suggested.
I checked but no VST2.4 plug-in in plug-in Manager, only the VST3.
Maybe a cache issue or something else (I read in an other post something similar happens).
Anyway, my main purpose so far was for the NKS compatibility, but I’ll check this a bit deeper in the following days.
Again, my thanks for your kind help.

Best regards
Xavier