Plugin Directory Scanner Question


#1

Hi all,

I’m trying to populate a KnownList with AU plugins from the default folder, however, the consequent popup list isn’t being filled with any values?

Am I missing a method from the pluginDirectoryScanner potentially, or misunderstanding the search path?

    // Create object of list of known plugins.
    KnownPluginList knownPluginList;
    knownPluginList.clearBlacklistedFiles();
    
    // Specifiy the plugin format (AU) and search path.
    AudioUnitPluginFormat pluginFormat;
    FileSearchPath searchPath ("~/Library/Audio/Plug-Ins/Components");
    
    // Create scanner for  directory and populate plugin list.
    PluginDirectoryScanner pluginDirectoryScanner (knownPluginList,
                                                   pluginFormat,
                                                   searchPath,
                                                   true /*is reccursive*/,
                                                   File(),
                                                   true /*is asyncronous*/);

    // Create popup menu and fill with known plugins
    PopupMenu m;
    knownPluginList.addToMenu (m, KnownPluginList::defaultOrder);
    
    const int choice = m.show();
    
    // Oh no... they aren't being shown, nothing in list :(

Thanks,
Corey


#2

You will actually have to scan with the PluginDirectoryScanner in order for the KnownPluginList to be populated, it’s not enough to just create the scanner instance.

So, something like :


void scanPlugins(PluginDirectoryScanner& scanner)
{
    String plugname;
    while (true)
    {
        String nextname = scanner.getNextPluginFileThatWillBeScanned();
        if (scanner.scanNextFile(true, plugname)==false)
            break;
    }
}

String doAUPluginScan(KnownPluginList& kpl)
{
    AudioUnitPluginFormat aupf;
    PluginDirectoryScanner scanner(kpl, aupf, aupf.getDefaultLocationsToSearch(), true, File());
    scanPlugins(scanner);
    return String();
}

However, if you are working with a GUI application, it’s probably easiest to deal with the plugin scanning with the JUCE PluginListComponent. (I had to write the manual scanning code for a command line program which obviously can’t use the GUI component.)