Standalone vs VST defs

I have built a plugin. I have been testing as a standalone app and now I want to build as a vst. I have a media player window that gets added to the processor chain to test the plugin and make dev easy. I have built DLL’s for VST and all loads fine in DAW but the window for the player still opens. I used this check for stuff I only want in standalone mode

#if JucePlugin_Build_Standalone == 1
…// code I want in standalone mode

Is there a different definition I should be using as it seems the VST projects inherit the SharedCode projects without overriding?

Indeed, the define doesn’t help in the shared code.
But there is a static method in JUCEApplicationBase:
static bool JUCEApplicationBase::isStandaloneApplication()

Returns true if this executable is running as an app (as opposed to being a plugin or other kind of shared library.

Cool that will work but isn’t there a way of doing it at compile time :wink:

If it is called each sample or maybe each block, I would worry about that. If it is something how to present the UI, c’mon… :wink:

You would have to implement both variants and make sure to distinguish from outside the shared library (i.e. in the wrapper). Maybe some template wizardry could be possible, but not without tweaking the wrappers…

Your choice :wink:

Yeah so I would never tie up extra conditionals per sample whenever possible and if I did I would only ever keep stuff that branch prediction can optimise away.

Yes I have a check on the callback loop and a couple for UI and works fine. I couldn’t give 2 hoots about the UI ones but I don’t like having in the callback loop.

I think you could get it working by declaring a function in a header (FormatSpecificFunctions.h) and implementing it in a different file per format: FormatSpecificFunctions_Standalone.cpp and FormatSpecificFunctions_VST.cpp. Projucer will take care of dispatching these .cpp files to the right target, like it does for the files of juce_audio_plugin_client, so each final target will have a single implementation of that function.

I’m happy to make an example project (using one of the JUCE example plugins) if something is not clear enough.

1 Like