Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions src/extended/PluginHostChildProcess/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,50 @@ class PluginHostApplication : public JUCEApplication {

deviceManager.initialise(256, 256, savedAudioState, true);

AudioPluginInstance *instance;
OwnedArray<juce::PluginDescription> foundPlugins;
VST3PluginFormat format;
format.findAllTypesForFile(foundPlugins, pluginPath);

description = foundPlugins[0];
AudioPluginInstance *instance = format.createInstanceFromDescription(
#if (JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to use these constants to detect if each plugin format class is defined. I don't know if there's a cleaner way to do it.

if (pluginPath.endsWith(".vst3")) {
Copy link
Contributor Author

@eliot-akira eliot-akira Apr 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this method .endsWith() in JUCE::String class.


VST3PluginFormat formatVST;

formatVST.findAllTypesForFile(foundPlugins, pluginPath);
description = foundPlugins[0];
instance = formatVST.createInstanceFromDescription(
*description, setup.sampleRate, setup.bufferSize);
}
#endif

#if (JUCE_PLUGINHOST_AU && (JUCE_MAC || JUCE_IOS))
if (pluginPath.endsWith(".component")) {

AudioUnitPluginFormat formatAU;

formatAU.findAllTypesForFile(foundPlugins, pluginPath);
description = foundPlugins[0];
instance = formatAU.createInstanceFromDescription(
*description, setup.sampleRate, setup.bufferSize);
}
#endif

#if (JUCE_PLUGINHOST_LADSPA && JUCE_LINUX)
if (pluginPath.endsWith(".so")) {

LADSPAPluginFormat formatLADSPA;

formatLADSPA.findAllTypesForFile(foundPlugins, pluginPath);
description = foundPlugins[0];
instance = formatLADSPA.createInstanceFromDescription(
*description, setup.sampleRate, setup.bufferSize);
}
#endif

// Plugin not found
if (instance == nullptr) {
// TODO: this->shutdown();
return;
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right approach I think, thanks a lot.

We should be able to clean this up a bit by pulling all of the macros and path checking into a private function that just returns an AudioUnitPluginFormat instance (the base class of LADSPAPluginFormat, AudioUnitPluginFormat and VST3PluginFormat)

something like

AudioUnitPluginFormat format = getPluginFormat(pluginPath) formatAU.findAllTypesForFile(foundPlugins, pluginPath); description = foundPlugins[0]; instance = formatAU.createInstanceFromDescription(*description, setup.sampleRate, setup.bufferSize); 

where getPluginFormat is something like:

AudioPluginFormat getPluginFormat(const String &commandLine) { #if (JUCE_PLUGINHOST_LADSPA && JUCE_LINUX) if (pluginPath.endsWith(".so")) { return LADSPAPluginFormat();} #endif ... } 

Would you mind giving that shot?

Thanks again!

// i/o graph nodes
inputProcessor = new AudioProcessorGraph::AudioGraphIOProcessor(
Expand Down