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

Method parsePluginLayouts

Server/Source/Server.cpp:293–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293bool Server::parsePluginLayouts(const String& id) {
294 if (m_jpluginLayouts.empty() && !m_pluginList.getTypes().isEmpty()) {
295 if (m_sandboxModeRuntime == SANDBOX_NONE) {
296 String msg =
297 "No cached plugin layouts have been found. This can increase plugin loading times and not all "
298 "I/O configurations might be available.";
299 msg << newLine << newLine << "Do you want to rescan your plugins?";
300 if (AlertWindow::showOkCancelBox(AlertWindow::QuestionIcon, "Missing Plugin I/O Layouts", msg, "Yes",
301 "No")) {
302 m_pluginList.clear();
303 saveKnownPluginList();
304 getApp()->restartServer(true);
305 return false;
306 }
307 }
308 } else {
309 auto readLayouts = [this](const std::string& key, const auto& jlayouts) {
310 if (jlayouts.is_array()) {
311 for (auto& jlayout : jlayouts) {
312 auto layout = deserializeLayout(jsonGetValue(jlayout, "layout", String()));
313 m_pluginLayouts[key].add(layout);
314 }
315 }
316 };
317
318 try {
319 logln("parsing " << m_jpluginLayouts.size() << " plugin layouts..."
320 << (id.isNotEmpty() ? " (id=" + id + ")" : String()));
321
322 if (id.isNotEmpty()) {
323 auto it = m_jpluginLayouts.find(id.toStdString());
324 if (it != m_jpluginLayouts.end()) {
325 readLayouts(it.key(), it.value());
326 }
327 } else {
328 for (auto it = m_jpluginLayouts.begin(); it != m_jpluginLayouts.end(); it++) {
329 readLayouts(it.key(), it.value());
330 }
331 }
332
333 logln("...ok");
334 } catch (const json::exception& e) {
335 logln("parsing plugin layouts failed: " << e.what());
336 }
337 }
338 return true;
339}
340
341const Array<AudioProcessor::BusesLayout>& Server::getPluginLayouts(const String& id) {
342 auto it = m_pluginLayouts.find(id);

Callers

nothing calls this directly

Calls 12

deserializeLayoutFunction · 0.85
jsonGetValueFunction · 0.85
emptyMethod · 0.80
restartServerMethod · 0.80
whatMethod · 0.80
clearMethod · 0.45
addMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected