Hi,
does anyone know whether I can use only the Juce-GUI in combination with the plain VST-SDK? Is there a way straight forward to do so? I really like the approach of being very close to the VST-API and their implementation - that’s why I’d like to keep using the VST-SDK directly without any translation or wrapping in between. And the VSTGUI has some flaws, unfortunately.
Thanks!
yes you can. Best thing to do might be to build juce as a static library.
here is a VST3 EditorView (probably wont compile without some tweaks) that you could use roughly like this…
IPlugView* PLUGIN_API YourVST3EditController::createView (FIDString name)
{
if (strcmp (name, ViewType::kEditor) == 0)
{
return new JuceEditorView(this);
}
return 0;
}
class JuceEditorView : public EditorView
{
public:
JuceEditorView(EditController* controller, ViewRect* size = 0)
: EditorView (controller, size)
{
initialiseJuce_GUI();
mComponent = std::make_unique<YourJUCEComponent>();
}
~JuceEditorView()
{
mComponent = nullptr;
shutdownJuce_GUI();
}
// CPluginView overides
tresult PLUGIN_API attached(void* parent, FIDString type)
{
mComponent->addToDesktop (0 /*ComponentPeer::windowIgnoresKeyPresses*/, parent);
mComponent->setOpaque(false);
mComponent->setVisible (true);
mComponent->toFront (false);
return kResultTrue;
}
tresult PLUGIN_API removed()
{
mComponent->removeFromDesktop();
return CPluginView::removed();
}
// IPlugView overides
tresult PLUGIN_API onSize(ViewRect* newSize)
{
if (newSize)
{
rect = *newSize;
mComponent->setSize(rect.getWidth(), rect.getHeight());
}
return kResultTrue;
}
tresult PLUGIN_API getSize(ViewRect* size);
{
*size = ViewRect(0, 0, mComponent->getWidth(), mComponent->getHeight());
return kResultTrue;
}
tresult PLUGIN_API isPlatformTypeSupported(FIDString type)
{
#ifdef OS_WIN
if (strcmp (type, kPlatformTypeHWND) == 0)
return kResultTrue;
#elif defined OS_OSX
if (strcmp (type, kPlatformTypeNSView) == 0)
return kResultTrue;
else if (strcmp (type, kPlatformTypeHIView) == 0)
return kResultFalse;
#endif
return kResultFalse;
}
private:
std::unique_ptr<juce::Component> mComponent;
};
1 Like
Cool, thanks! My evening is saved