A brief sidebar on what these plugins are — after writing the last post I realized that I had blown past the issue completely.

If you had walked into a recording studio 20 years ago, you’d find racks of signal processing hardware that the engineers would route different channels through to add different effects like equalization, compressing dynamic range, adding reverberation and echo, etc. The output from this signal processing chain would end up being output to multitrack tape for eventual mixdown to stereo output that could be pressed on CD.

Universal Audio’s 1176 Plugin collection

In the last 20 years, however, more and more studios have moved to a more-or-less fully digital environment; instead of being based around tape, all recording is done using digital audio workstation software running on a powerful modern computer. Somewhere along the way, engineers realized that the racks of hardware could be reduced (with varying degrees of success) to algorithmic recreations of those processors, keeping all processing in the digital domain. Any DAW you’ll find today has the ability to load effects plugins in either Steinberg’s VST format or Apple’s AudioUnit (AU) formats.

Each track of the Scumbler app will be able to load up to 4 plugins before the loop effect and another 4 after the loop.

Useful JUCE Classes

As we saw in Part 1 of this series, JUCE comes with a lot of the code that we need for this task built-in and ready to bake into your application. In order to be able to add support for plugins, we need our app to support these operations:

KnownPluginList

http://www.rawmaterialsoftware.com/juce/api/classKnownPluginList.html

The KnownPluginList class maintains a list of the plugins that are installed on the user’s system. Additionally, this class knows how to sort itself in a few useful user-selectable ways (e.g., group by manufacturer, group by different plugin types, etc.), and can also populate a JUCE PopupMenu for easy user selection. Like many of the JUCE built-in classes, it can persist itself to and from XML, and being able to store the list of installed plugins saves your users the time of re-scanning their system for plugins every time they launch your app.

Your app should create a single instance of this class that’s used throughout. (I”m currently using a global variable for this, which makes me sad every time I see it in the code. Getting rid of globals is on my list of future tasks…) As part of application startup, try to recreate the list from XML (here, the app uses a single XML file for all user preferences):

PluginDescription

As we saw above in the KnownPluginList section, after populating a menu with the available plugins, after the user selects one, we can retrieve an instance of the PluginDescription class to find out details about that plugin. We’ll use that object in just a minute to actually get the plugin loaded, but it’s also going to be the eventual mechanism we use when we want to be able to persist Scumbler configurations to and from disk.

AudioPluginFormatManager

The last piece that we’ll look at in this installment is the AudioPluginFormatManager class. Your app should create a single shared instance of this class that’s used to find and load plugins. This class also is the source of my one quibble so far with JUCE’s design — it seems to me that there’s logically a tighter coupling between this class and the KnownPluginList than is expressed in the design. Jules is a clever designer, so I suspect that there’s a reason for this choice that hasn’t made itself obvious to me yet.

Early in your app’s life, be sure to tell this object what formats it needs to support — if you don’t at least tell it to look for the default formats, you’ll scratch your head wondering why your app lies to you and says that you don’t have any plugins installed at all.

// make sure that the plugin format manager knows to look for AU/VST formats.
fPluginManager.addDefaultFormats();

When your user selects a plugin and retrieves a PluginDescription object from the KnownPluginList, you can pass that PluginDescription object to your AudioPluginFormatManager object to get the plugin loaded up:

Art+Logic has been designing and developing innovative custom software since 1991. We have built software for over 900 clients from a diverse set of industries including education, aerospace, music technology, consumer electronics, entertainment, financial services, and more. Coding the “impossible.”®