Standalone App and Plugin Template/Tutorial


#1

Does anyone have an up-to-date template or instructions on how to go about making an app that targets plugins and standalone situations?

If not it could it be a good idea for a tutorial? Or is it too much a context-dependent task?

Cheers,

C


#2

Just use the juce_StandaloneFilterWindow.h:

https://github.com/julianstorer/JUCE/blob/master/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h

Here are the steps I'd take if I wanted to wrap an existing plugin project into a standalone application.  

  1. Launch the Introjucer and create a new audio application, select 'Don't create any source files' or whatever that option is. I'm not near an Introjucer right now! You just want to create an empty audio application. Include whatever modules you think you will need. Save the project and proceed to Step 2...
  2. Copy juce_StandaloneFilterWindow.h and place it into your Source tree. You can also copy your plugin project's source files to your new project's source folder. Then create a .cpp file, call it whatever, StandaloneFtiler.cpp for example. It should look something like this:
  3. #include "juce_StandaloneFilterWindow.h.h"
    

    PropertySet* defaultPropSet = nullptr;

    class StandaloneFilter : public JUCEApplication
    {
    public:
    StandaloneFilter()
    {
    }
    void initialise(const String& commandLineParameters)
    {
    filterWindow = new StandaloneFilterWindow (“FilterApp”,
    Colours::black,
    defaultPropSet,
    true);

        filterWindow->setTitleBarButtonsRequired (DocumentWindow::allButtons, false);
        filterWindow->setVisible (true);
        //turn off resizeable...
        filterWindow->setResizable(true, true);
        juce::Thread::setCurrentThreadName("appName");
    }
    void shutdown()
    {
        filterWindow = 0;// = nullptr;
    }
    const String getApplicationName()
    {
        return String("appName");
    }
    const String getApplicationVersion()
    {
        return String("0.0");
    }
    bool moreThanOneInstanceAllowed()
    {
        return true;
    }
    

    private:
    ScopedPointer<StandaloneFilterWindow> filterWindow;
    };
    START_JUCE_APPLICATION (StandaloneFilter)

  4. The code above will instantiate a StandaloneFilterWindow that can be used to load your plugin class. 
  5. Open up the Introjucer again if you've closed it, and add the contents of your Source dir to the build so that your poject will build your plugin source and the StandaloneFilterWindow source. 
  6. Make sure you add includes to the top of your StandaloneFilterWindow.h so that it can find your PluginProcessor header.  When createPlugin() is called on line 78 of juce_StandaloneFilterWindow.h it should create an instance of your plugin.  
    ​​

Note that I haven't tested that .cpp code, so you may need to make some adjustments. I'm also trying to remember how to do all of this off the top of my head so please excuse anything I may have forgotten to mention. 


#3

Very useful Rory and it seems well explained, I haven't tried it yet but will do asap. Hopefully others will find it useful as well.


#4

Works like a charm!

Also I had to copy across the AppConfig.h settings related to the plugin into to the standalone AppConfig.h ...


#5

That's right, I forgot about that. Glad to know it's working.  


#6

I’m looking to do this the other way around - make a plugin version of a standalone app. Any more recent recommendations on how best to go about that?


#7

Sorry, I’ve always made a point of creating plugins that can be encapsulated in a standalone than the other way around. Even my standalone apps are basically plugins under hood.


#8

@Rory would you recommend this approach then? Thing is there are certain aspects of the UI that would need to change e.g. removing audio/midi device selector in the plugin.
I can see it would require a bit of code reorganisation to turn it into a plugin…


#9

I think it may, but it depends on how your structured your code. To be honest, in over 10 years of using JUCE I’ve never once created a standalone app :scream:

I guess others will have a better idea of how best to do this.


#10

Could this be used with a vst, not created with juce?