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

SDK for VST 3 audio plug-in and host development.
Post Reply
zabukowski
Posts: 4
Joined: Wed Jul 13, 2016 10:15 am

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

Post by zabukowski »

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).

Code: Select all

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.

Thanks!!!
Last edited by zabukowski on Thu Sep 17, 2020 6:53 am, edited 1 time in total.

User avatar
ygrabit
Posts: 179
Joined: Fri Jun 17, 2016 7:52 am
Location: Hamburg
Contact:

Re: How to set unique ID of VST3 plugin dynamically?

Post by ygrabit »

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

Code: Select all

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
}

END_FACTORY
YVan Grabit

zabukowski
Posts: 4
Joined: Wed Jul 13, 2016 10:15 am

Re: How to set unique ID of VST3 plugin dynamically?

Post by zabukowski »

Hi Yvan ... thx for your answer.

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

Code: Select all

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 :)

zabukowski
Posts: 4
Joined: Wed Jul 13, 2016 10:15 am

Re: How to set unique ID of VST3 plugin dynamically?

Post by zabukowski »

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).

Thx!

zabukowski
Posts: 4
Joined: Wed Jul 13, 2016 10:15 am

Re: How to set unique ID of VST3 plugin dynamically? - SOLVED

Post by zabukowski »

Mission accomplished - it works like a charm :)

Yvan, thanks for help!

Post Reply