Add TAL-Reverb-II plugin to test
[juce-lv2.git] / juce / source / src / audio / plugin_host / juce_PluginDirectoryScanner.h
blob22c5a5ecbfa827f7e8a89ff58cfb4418a72b9224
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
27 #define __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__
29 #include "juce_KnownPluginList.h"
30 #include "juce_AudioPluginFormatManager.h"
33 //==============================================================================
34 /**
35 Scans a directory for plugins, and adds them to a KnownPluginList.
37 To use one of these, create it and call scanNextFile() repeatedly, until
38 it returns false.
40 class JUCE_API PluginDirectoryScanner
42 public:
43 //==============================================================================
44 /**
45 Creates a scanner.
47 @param listToAddResultsTo this will get the new types added to it.
48 @param formatToLookFor this is the type of format that you want to look for
49 @param directoriesToSearch the path to search
50 @param searchRecursively true to search recursively
51 @param deadMansPedalFile if this isn't File::nonexistent, then it will
52 be used as a file to store the names of any plugins
53 that crash during initialisation. If there are
54 any plugins listed in it, then these will always
55 be scanned after all other possible files have
56 been tried - in this way, even if there's a few
57 dodgy plugins in your path, then a couple of rescans
58 will still manage to find all the proper plugins.
59 It's probably best to choose a file in the user's
60 application data directory (alongside your app's
61 settings file) for this. The file format it uses
62 is just a list of filenames of the modules that
63 failed.
65 PluginDirectoryScanner (KnownPluginList& listToAddResultsTo,
66 AudioPluginFormat& formatToLookFor,
67 FileSearchPath directoriesToSearch,
68 bool searchRecursively,
69 const File& deadMansPedalFile);
71 /** Destructor. */
72 ~PluginDirectoryScanner();
74 //==============================================================================
75 /** Tries the next likely-looking file.
77 If dontRescanIfAlreadyInList is true, then the file will only be loaded and
78 re-tested if it's not already in the list, or if the file's modification
79 time has changed since the list was created. If dontRescanIfAlreadyInList is
80 false, the file will always be reloaded and tested.
82 Returns false when there are no more files to try.
84 bool scanNextFile (bool dontRescanIfAlreadyInList);
86 /** Skips over the next file without scanning it.
87 Returns false when there are no more files to try.
89 bool skipNextFile();
91 /** Returns the description of the plugin that will be scanned during the next
92 call to scanNextFile().
94 This is handy if you want to show the user which file is currently getting
95 scanned.
97 const String getNextPluginFileThatWillBeScanned() const;
99 /** Returns the estimated progress, between 0 and 1.
101 float getProgress() const { return progress; }
103 /** This returns a list of all the filenames of things that looked like being
104 a plugin file, but which failed to open for some reason.
106 const StringArray& getFailedFiles() const noexcept { return failedFiles; }
108 private:
109 //==============================================================================
110 KnownPluginList& list;
111 AudioPluginFormat& format;
112 StringArray filesOrIdentifiersToScan;
113 File deadMansPedalFile;
114 StringArray failedFiles;
115 int nextIndex;
116 float progress;
118 StringArray getDeadMansPedalFile();
119 void setDeadMansPedalFile (const StringArray& newContents);
121 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PluginDirectoryScanner);
125 #endif // __JUCE_PLUGINDIRECTORYSCANNER_JUCEHEADER__