-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for AudioUnit and LADSPA plugin formats #12
base: master
Are you sure you want to change the base?
Conversation
|
||
description = foundPlugins[0]; | ||
AudioPluginInstance *instance = format.createInstanceFromDescription( | ||
#if (JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS)) |
There was a problem hiding this comment.
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.
description = foundPlugins[0]; | ||
AudioPluginInstance *instance = format.createInstanceFromDescription( | ||
#if (JUCE_PLUGINHOST_VST3 && (JUCE_MAC || JUCE_WINDOWS)) | ||
if (pluginPath.endsWith(".vst3")) { |
There was a problem hiding this comment.
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.
if (instance == nullptr) { | ||
// TODO: this->shutdown(); | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
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 confirmed that it works for AudioUnit effects. Haven't tested AudioUnit instruments, nor LADSPA plugins on Linux.
As mentioned in issue #9, I'm not so familiar with C++ so the code could probably be written more efficiently. Any advice would be appreciated. 😉