MCPcopy Create free account
hub / github.com/apohl79/audiogridder / loadKnownPluginList

Method loadKnownPluginList

Server/Source/Server.cpp:233–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233void Server::loadKnownPluginList() {
234 traceScope();
235
236 loadKnownPluginList(m_pluginList, m_jpluginLayouts, getId());
237
238 std::map<String, PluginDescription> dedupMap;
239
240 for (auto& desc : m_pluginList.getTypes()) {
241 std::unique_ptr<AudioPluginFormat> fmt;
242 auto pluginId = Processor::createPluginID(desc);
243
244 if (desc.pluginFormatName == "AudioUnit") {
245#if JUCE_MAC
246 fmt = std::make_unique<AudioUnitPluginFormat>();
247#endif
248 } else if (desc.pluginFormatName == "VST") {
249#if JUCE_PLUGINHOST_VST
250 fmt = std::make_unique<VSTPluginFormat>();
251#endif
252 } else if (desc.pluginFormatName == "VST3") {
253 fmt = std::make_unique<VST3PluginFormat>();
254 }
255
256 if (nullptr != fmt) {
257 auto name = fmt->getNameOfPluginFromIdentifier(desc.fileOrIdentifier);
258 if (File(name).exists()) {
259 name = File(name).getFileName();
260 }
261 if (shouldExclude(name, desc.fileOrIdentifier)) {
262 m_pluginList.removeType(desc);
263 m_jpluginLayouts.erase(pluginId.toStdString());
264 }
265 }
266
267 bool updateDedupMap = true;
268
269 auto it = dedupMap.find(pluginId);
270 if (it != dedupMap.end()) {
271 auto& descExists = it->second;
272 if (desc.version.compare(descExists.version) < 0) {
273 // existing one is newer, remove current
274 updateDedupMap = false;
275 m_pluginList.removeType(desc);
276 m_jpluginLayouts.erase(pluginId.toStdString());
277 logln(" info: ignoring " << desc.descriptiveName << " (" << desc.version << ") due to newer version");
278 } else {
279 // existing one is older, keep current
280 m_pluginList.removeType(descExists);
281 m_jpluginLayouts.erase(Processor::createPluginID(descExists).toStdString());
282 logln(" info: ignoring " << descExists.descriptiveName << " (" << descExists.version
283 << ") due to newer version");
284 }
285 }
286
287 if (updateDedupMap) {
288 dedupMap[pluginId] = desc;
289 }
290 }

Callers

nothing calls this directly

Calls 6

getConfigFileNameFunction · 0.85
parseFunction · 0.85
jsonReadFileFunction · 0.85
existsMethod · 0.80
eraseMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected