JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::PluginDirectoryScanner Class Reference

Scans a directory for plugins, and adds them to a KnownPluginList. More...

#include <juce_PluginDirectoryScanner.h>

Collaboration diagram for juce::PluginDirectoryScanner:

Public Member Functions

 PluginDirectoryScanner (KnownPluginList &listToAddResultsTo, AudioPluginFormat &formatToLookFor, FileSearchPath directoriesToSearch, bool searchRecursively, const File &deadMansPedalFile, bool allowPluginsWhichRequireAsynchronousInstantiation=false)
 Creates a scanner. More...
 
 ~PluginDirectoryScanner ()
 Destructor. More...
 
const StringArraygetFailedFiles () const noexcept
 This returns a list of all the filenames of things that looked like being a plugin file, but which failed to open for some reason. More...
 
String getNextPluginFileThatWillBeScanned () const
 Returns the description of the plugin that will be scanned during the next call to scanNextFile(). More...
 
float getProgress () const
 Returns the estimated progress, between 0 and 1. More...
 
bool scanNextFile (bool dontRescanIfAlreadyInList, String &nameOfPluginBeingScanned)
 Tries the next likely-looking file. More...
 
void setFilesOrIdentifiersToScan (const StringArray &filesOrIdentifiersToScan)
 Sets a specific list of filesOrIdentifiersToScan to scan. More...
 
bool skipNextFile ()
 Skips over the next file without scanning it. More...
 

Static Public Member Functions

static void applyBlacklistingsFromDeadMansPedal (KnownPluginList &listToApplyTo, const File &deadMansPedalFile)
 Reads the given dead-mans-pedal file and applies its contents to the list. More...
 

Private Member Functions

void setDeadMansPedalFile (const StringArray &newContents)
 
void updateProgress ()
 

Private Attributes

const bool allowAsync
 
File deadMansPedalFile
 
StringArray failedFiles
 
StringArray filesOrIdentifiersToScan
 
AudioPluginFormatformat
 
KnownPluginListlist
 
Atomic< intnextIndex
 
std::atomic< floatprogress { 0.0f }
 

Detailed Description

Scans a directory for plugins, and adds them to a KnownPluginList.

To use one of these, create it and call scanNextFile() repeatedly, until it returns false.

@tags{Audio}

Constructor & Destructor Documentation

◆ PluginDirectoryScanner()

juce::PluginDirectoryScanner::PluginDirectoryScanner ( KnownPluginList listToAddResultsTo,
AudioPluginFormat formatToLookFor,
FileSearchPath  directoriesToSearch,
bool  searchRecursively,
const File deadMansPedalFile,
bool  allowPluginsWhichRequireAsynchronousInstantiation = false 
)

Creates a scanner.

Parameters
listToAddResultsTothis will get the new types added to it.
formatToLookForthis is the type of format that you want to look for
directoriesToSearchthe path to search
searchRecursivelytrue to search recursively
deadMansPedalFileif this isn't File(), then it will be used as a file to store the names of any plugins that crash during initialisation. If there are any plugins listed in it, then these will always be scanned after all other possible files have been tried - in this way, even if there's a few dodgy plugins in your path, then a couple of rescans will still manage to find all the proper plugins. It's probably best to choose a file in the user's application data directory (alongside your app's settings file) for this. The file format it uses is just a list of filenames of the modules that failed.
allowPluginsWhichRequireAsynchronousInstantiationIf this is false then the scanner will exclude plug-ins asynchronous creation - such as AUv3 plug-ins.

◆ ~PluginDirectoryScanner()

juce::PluginDirectoryScanner::~PluginDirectoryScanner ( )

Destructor.

Member Function Documentation

◆ applyBlacklistingsFromDeadMansPedal()

static void juce::PluginDirectoryScanner::applyBlacklistingsFromDeadMansPedal ( KnownPluginList listToApplyTo,
const File deadMansPedalFile 
)
static

Reads the given dead-mans-pedal file and applies its contents to the list.

◆ getFailedFiles()

const StringArray& juce::PluginDirectoryScanner::getFailedFiles ( ) const
inlinenoexcept

This returns a list of all the filenames of things that looked like being a plugin file, but which failed to open for some reason.

◆ getNextPluginFileThatWillBeScanned()

String juce::PluginDirectoryScanner::getNextPluginFileThatWillBeScanned ( ) const

Returns the description of the plugin that will be scanned during the next call to scanNextFile().

This is handy if you want to show the user which file is currently getting scanned.

◆ getProgress()

float juce::PluginDirectoryScanner::getProgress ( ) const
inline

Returns the estimated progress, between 0 and 1.

◆ scanNextFile()

bool juce::PluginDirectoryScanner::scanNextFile ( bool  dontRescanIfAlreadyInList,
String nameOfPluginBeingScanned 
)

Tries the next likely-looking file.

If dontRescanIfAlreadyInList is true, then the file will only be loaded and re-tested if it's not already in the list, or if the file's modification time has changed since the list was created. If dontRescanIfAlreadyInList is false, the file will always be reloaded and tested. The nameOfPluginBeingScanned will be updated to the name of the plugin being scanned before the scan starts.

Returns false when there are no more files to try.

◆ setDeadMansPedalFile()

void juce::PluginDirectoryScanner::setDeadMansPedalFile ( const StringArray newContents)
private

◆ setFilesOrIdentifiersToScan()

void juce::PluginDirectoryScanner::setFilesOrIdentifiersToScan ( const StringArray filesOrIdentifiersToScan)

Sets a specific list of filesOrIdentifiersToScan to scan.

N.B. This list must match the format passed to the constructor.

See also
AudioPluginFormat::searchPathsForPlugins

◆ skipNextFile()

bool juce::PluginDirectoryScanner::skipNextFile ( )

Skips over the next file without scanning it.

Returns false when there are no more files to try.

◆ updateProgress()

void juce::PluginDirectoryScanner::updateProgress ( )
private

Member Data Documentation

◆ allowAsync

const bool juce::PluginDirectoryScanner::allowAsync
private

◆ deadMansPedalFile

File juce::PluginDirectoryScanner::deadMansPedalFile
private

◆ failedFiles

StringArray juce::PluginDirectoryScanner::failedFiles
private

◆ filesOrIdentifiersToScan

StringArray juce::PluginDirectoryScanner::filesOrIdentifiersToScan
private

◆ format

AudioPluginFormat& juce::PluginDirectoryScanner::format
private

◆ list

KnownPluginList& juce::PluginDirectoryScanner::list
private

◆ nextIndex

Atomic<int> juce::PluginDirectoryScanner::nextIndex
private

◆ progress

std::atomic<float> juce::PluginDirectoryScanner::progress { 0.0f }
private

The documentation for this class was generated from the following file: