Opening plugins


#1

Hey,

After seeing some inspiring talks at ADC last week I’ve decided to revive a 2 year old project of mine that I never got round to finishing, however when attempting to run it with the latest version of JUCE I’m getting errors.

Essentially I’m attempting to load an audio plugin within a plugin, and now when I try to load a plugin file with createPluginInstance() I get the following error message: “No compatible plug-in format exists for this plug-in”, which sets my AudioPluginInstance instance object to be a nullptr.

Here is my code for doing this which did previously work with whatever the latest JUCE version was in June 2014:

AudioPluginFormatManager formatManager;
AudioPluginInstance *pluginInstance;
PluginDescription wrappedPluginInfo;

formatManager.addDefaultFormats();
String errorMessage;

if (AudioProcessor::wrapperType == wrapperType_AudioUnit)
{
    wrappedPluginInfo.fileOrIdentifier = "/Library/Audio/Plug-Ins/Components/Driver.component";
}
else if (AudioProcessor::wrapperType == wrapperType_VST)
{
    wrappedPluginInfo.fileOrIdentifier = "/Library/Audio/Plug-Ins/VST/Driver.vst";
}

pluginInstance = formatManager.createPluginInstance (wrappedPluginInfo, 48000, 512, errorMessage);

if (pluginInstance == nullptr)
{
    std::cout << errorMessage << std::endl;
}

What’s changed or what have I done wrong?

Many thanks.


#2

Try something like this:

String pluginPath;
if (AudioProcessor::wrapperType == wrapperType_AudioUnit)
    pluginPath = "/Library/Audio/Plug-Ins/Components/Driver.component";
else if (AudioProcessor::wrapperType == wrapperType_VST)
    pluginPath = "/Library/Audio/Plug-Ins/VST/Driver.vst";

OwnedArray<PluginDescription> pluginDescriptions;
KnownPluginList plist;
AudioPluginFormatManager pluginFormatManager;
pluginFormatManager.addDefaultFormats();
for (int i = 0; i < pluginFormatManager.getNumFormats(); ++i)
    plist.scanAndAddFile(pluginPath,
                         true,
                         pluginDescriptions,
                         *pluginFormatManager.getFormat(i));

jassert (pluginDescriptions.size() > 0);
String msg;
instance = pluginFormatManager.createPluginInstance(*pluginDescriptions[0],
                                                    48000,
                                                    512,
                                                    msg);

There may be a typo in there somewhere!


#3

Hey Tom,

Many thanks for this - it’s working perfectly now!