[Solved] How to set unique ID of VST3 plugin dynamically?

I am developing a JUCE based plugin, which gets its ID (magic, vendor etc.) in realtime at startup from outside (config file). I managed to do it pretty efficiently with AAX and AU wrappers, but i am stuck with VST3 wrapper.

Looking at the wrapper code and generally VST3 examples from SDK, i can see all needed IIDs are defined statically (processors, controller, component).

DECLARE_CLASS_IID (JuceAudioProcessor, 0x0101ABAB, 0xABCDEF01, JucePlugin_ManufacturerCode, JucePlugin_PluginCode)
DEF_CLASS_IID (JuceAudioProcessor)

DECLARE_CLASS_IID (JuceVST3EditController, 0xABCDEF01, 0x1234ABCD, JucePlugin_ManufacturerCode, JucePlugin_PluginCode)
DEF_CLASS_IID (JuceVST3EditController)

DECLARE_CLASS_IID (JuceVST3Component, 0xABCDEF01, 0x9182FAEB, JucePlugin_ManufacturerCode, JucePlugin_PluginCode)
DEF_CLASS_IID (JuceVST3Component)

If these could be dynamically defined/assigned inside GetPluginFactory() function, the problem would be solved. But obviously it doesn’t work that way.

Anyne have an idea or hint, how this could be solved or if it’s even possible to do with VST3 SDK.


you can write your own DEF_CLASS implementation (do not use DEF_CLASS):
in you entry file:

BEGIN_FACTORY (stringSteinberg, stringSteinbergURL, stringSteinbergEmail, PFactoryInfo::kUnicode)

	// check which classFlags (Vst::kDistributable..), subCategories, version and name you want
	TUID lcid = cid; // read a cid from your config file
	static PClassInfo2 componentClass (lcid, PClassInfo::kManyInstances,kVstAudioEffectClass,name,classFlags,subCategories,0,version,kVstVersionString)
	gPluginFactory->registerClass (&componentClass,createMethod); // register the class


Hi Yvan … thx for your answer.

I don’t have a problem assigning unique CID to component … it’s already happening in GetPluginFactory() function.

static const PClassInfo2 componentClass (JuceVST3Component::iid,
                                                 PClassInfo::kManyInstances, ...

I don’t know how and where to assign my custom ID to JuceVST3Component::iid (which is provided as a parameter to componentClass). Currently, DEF_CLASS is used to set JuceVST3Component::iid, but it can be used only statically.

I hope i understood your answer properly and i hope my questions are clear enough.

Sorry for maybe trivial questions - i am not really good with VST3 SDK, JUCE is successfully hiding most of the details from me, but in this case i have to learn things better :slight_smile:

Digging deeper into this, now i completely understand your answer and i see the solution is basically very simple.

But, unfortunately JUCE wrapper does it in its own specific, more complex way and that makes things harder for me (it sets component’s IDs directly, before anything happens in plugin - with DEF_CLASS_IID macro).


Mission accomplished - it works like a charm :slight_smile:

Yvan, thanks for help!