VST3 Host Menu / Class Access


I’m in the process of porting Surge from hand rolled wrappers and vstgui to juce. It is, as you would expect, a joy - I mean that non-sarcastically. Thank you for providing quality well documented software. Our release in 3 weeks will be the last one on our hand-rolled code base, and after that Surge XT will be JUCE.

There’s only one feature gap which is in Surge we support VST3 menus. This lets Reaper and Bitwig and so on add things to our parameter menus and is great. I don’t actually use the host menu UI, I scan the data and add them as extensions to our built in menus. Super duper.

There’s no reason I can’t do this in JUCE also if I can get access to the VST3 classes. So in Surge I’m writing code which looks like this

  Steinberg::Vst::IComponentHandler *componentHandler = getController()->getComponentHandler();
    Steinberg::FUnknownPtr<Steinberg::Vst::IComponentHandler3> componentHandler3(componentHandler);
    Steinberg::Vst::IContextMenu *hostMenu = nullptr;
   if( componentHandler ) 
       hostMenu = componentHandler3->createContextMenu(this, &param);

in my menu callback then iterating over that host menu, making little lambdas, and sticking them in my popup.

I could basically reuse that code completely if I can get access to that IComponentHandler

My project has a function which is compiled only in the VST3, it is called in the plugins, etc… so all the conditional compile / conditional call stuff with plugin type is all fine.

But given an AudioProcessor and an AudioProcessorEditor reference, even knowing full well they are inside a VST3, I can’t figure out how to break the JUCE abstraction and give me a reference to the IEditController I know is there.

I read all the code in juce_blah_VST3* and I see the classes I want, but they are in a .cpp not a header and are all private. I’m happy to dynamic cast and stuff but to what?

So is there a good example of, if you need to, a plugin-side break-the-glass where we can get a reference to the raw VST3, VST2, AU API with some set of casts and checks?

Thanks so much!