| 291 | } |
| 292 | |
| 293 | bool 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 | |
| 341 | const Array<AudioProcessor::BusesLayout>& Server::getPluginLayouts(const String& id) { |
| 342 | auto it = m_pluginLayouts.find(id); |
nothing calls this directly
no test coverage detected