| 93 | }; |
| 94 | |
| 95 | void GetAvailableVSTs(std::vector<PluginDescription>& vsts) |
| 96 | { |
| 97 | vsts.clear(); |
| 98 | static bool sFirstTime = true; |
| 99 | if (sFirstTime) |
| 100 | { |
| 101 | auto file = juce::File(ofToDataPath("vst/found_vsts.xml")); |
| 102 | if (file.existsAsFile()) |
| 103 | { |
| 104 | auto xml = juce::parseXML(file); |
| 105 | TheSynth->GetKnownPluginList().recreateFromXml(*xml); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | auto types = TheSynth->GetKnownPluginList().getTypes(); |
| 110 | std::string formatPreferenceOrder = UserPrefs.plugin_preference_order.Get(); |
| 111 | bool allowDupes = formatPreferenceOrder.empty(); |
| 112 | if (!allowDupes) |
| 113 | { |
| 114 | PluginFormatSorter formatSorter(formatPreferenceOrder); |
| 115 | types.sort(formatSorter); |
| 116 | } |
| 117 | |
| 118 | Array<PluginDescription> filtered; |
| 119 | for (int i = 0; i < types.size(); ++i) |
| 120 | { |
| 121 | bool hasDupe = false; |
| 122 | for (int j = 0; j < filtered.size(); ++j) |
| 123 | { |
| 124 | if (types[i].name == filtered[j].name) |
| 125 | { |
| 126 | hasDupe = true; |
| 127 | break; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | if (!hasDupe || allowDupes) |
| 132 | filtered.add(types[i]); |
| 133 | } |
| 134 | |
| 135 | PluginNameSorter nameSorter; |
| 136 | filtered.sort(nameSorter); |
| 137 | for (int i = 0; i < filtered.size(); ++i) |
| 138 | vsts.push_back(filtered[i]); |
| 139 | |
| 140 | //for (int i = 0; i < 2000; ++i) |
| 141 | // vsts.insert(vsts.begin(), std::string("c:/a+") + ofToString(gRandom())); |
| 142 | |
| 143 | //SortByLastUsed(vsts); |
| 144 | |
| 145 | //add a bunch of duplicates to the list, to simulate a user with many VSTs |
| 146 | /*auto vstCopy = vsts; |
| 147 | for (int i = 0; i < 40; ++i) |
| 148 | vsts.insert(vsts.end(), vstCopy.begin(), vstCopy.end());*/ |
| 149 | |
| 150 | sFirstTime = false; |
| 151 | } |
| 152 |
no test coverage detected