| 1482 | } |
| 1483 | |
| 1484 | DspNetwork* DspNetwork::Holder::getOrCreate(const String& id) |
| 1485 | { |
| 1486 | auto asScriptProcessor = dynamic_cast<ProcessorWithScriptingContent*>(this); |
| 1487 | |
| 1488 | for (auto n : networks) |
| 1489 | { |
| 1490 | if (n->getId() == id) |
| 1491 | { |
| 1492 | setActiveNetwork(n); |
| 1493 | return n; |
| 1494 | } |
| 1495 | } |
| 1496 | |
| 1497 | ValueTree v(scriptnode::PropertyIds::Network); |
| 1498 | v.setProperty(scriptnode::PropertyIds::ID, id, nullptr); |
| 1499 | |
| 1500 | ValueTree s(scriptnode::PropertyIds::Node); |
| 1501 | s.setProperty(scriptnode::PropertyIds::FactoryPath, "container.chain", nullptr); |
| 1502 | s.setProperty(scriptnode::PropertyIds::ID, id, nullptr); |
| 1503 | |
| 1504 | v.addChild(s, -1, nullptr); |
| 1505 | |
| 1506 | #if USE_BACKEND |
| 1507 | for (auto f : BackendDllManager::getNetworkFiles(asScriptProcessor->getMainController_())) |
| 1508 | { |
| 1509 | if (f.getFileNameWithoutExtension() == id) |
| 1510 | { |
| 1511 | auto xml = XmlDocument::parse(f); |
| 1512 | |
| 1513 | if(xml->getTagName() != "empty") |
| 1514 | v = ValueTree::fromXml(*xml); |
| 1515 | |
| 1516 | break; |
| 1517 | } |
| 1518 | } |
| 1519 | #endif |
| 1520 | |
| 1521 | auto newNetwork = new DspNetwork(asScriptProcessor, v, isPolyphonic()); |
| 1522 | |
| 1523 | if (vk != nullptr) |
| 1524 | newNetwork->setVoiceKiller(vk); |
| 1525 | |
| 1526 | networks.add(newNetwork); |
| 1527 | |
| 1528 | setActiveNetwork(newNetwork); |
| 1529 | |
| 1530 | return newNetwork; |
| 1531 | } |
| 1532 | |
| 1533 | |
| 1534 | scriptnode::DspNetwork* DspNetwork::Holder::getOrCreate(const ValueTree& v) |
no test coverage detected