MCPcopy Create free account
hub / github.com/christophhart/HISE / getOrCreate

Method getOrCreate

hi_scripting/scripting/scriptnode/api/DspNetwork.cpp:1484–1531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1482}
1483
1484DspNetwork* 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
1534scriptnode::DspNetwork* DspNetwork::Holder::getOrCreate(const ValueTree& v)

Callers 7

updateClassIdMethod · 0.45
updateModelMethod · 0.45
setNetworkMethod · 0.45
ScriptNeuralNetworkMethod · 0.45
createDspNetworkMethod · 0.45

Calls 15

getMainController_Method · 0.80
setVoiceKillerMethod · 0.80
getExternalScriptFileMethod · 0.80
parseFunction · 0.50
isPolyphonicFunction · 0.50
getIdMethod · 0.45
setPropertyMethod · 0.45
addChildMethod · 0.45
getTagNameMethod · 0.45
addMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected