|
|
|
@@ -1657,8 +1657,6 @@ void CarlaEngine::saveProjectInternal(juce::MemoryOutputStream& outStream) const |
|
|
|
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false); |
|
|
|
} |
|
|
|
|
|
|
|
bool saveExternalConnections = true; |
|
|
|
|
|
|
|
// save internal connections |
|
|
|
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) |
|
|
|
{ |
|
|
|
@@ -1686,18 +1684,22 @@ void CarlaEngine::saveProjectInternal(juce::MemoryOutputStream& outStream) const |
|
|
|
outStream << outPatchbay; |
|
|
|
} |
|
|
|
} |
|
|
|
// if we're running inside some session-manager, let them handle the connections |
|
|
|
|
|
|
|
// if we're running inside some session-manager (and using JACK), let them handle the connections |
|
|
|
bool saveExternalConnections; |
|
|
|
|
|
|
|
/**/ if (std::strcmp(getCurrentDriverName(), "Plugin") == 0) |
|
|
|
saveExternalConnections = false; |
|
|
|
else if (std::strcmp(getCurrentDriverName(), "JACK") != 0) |
|
|
|
saveExternalConnections = true; |
|
|
|
else if (std::getenv("CARLA_DONT_MANAGE_CONNECTIONS") != nullptr) |
|
|
|
saveExternalConnections = false; |
|
|
|
else if (std::getenv("LADISH_APP_NAME") != nullptr) |
|
|
|
saveExternalConnections = false; |
|
|
|
else if (std::getenv("NSM_URL") != nullptr) |
|
|
|
saveExternalConnections = false; |
|
|
|
else |
|
|
|
{ |
|
|
|
/**/ if (std::getenv("CARLA_DONT_MANAGE_CONNECTIONS") != nullptr) |
|
|
|
saveExternalConnections = false; |
|
|
|
else if (std::getenv("LADISH_APP_NAME") != nullptr) |
|
|
|
saveExternalConnections = false; |
|
|
|
else if (std::getenv("NSM_URL") != nullptr) |
|
|
|
saveExternalConnections = false; |
|
|
|
else if (std::strcmp(getCurrentDriverName(), "Plugin") == 0) |
|
|
|
saveExternalConnections = false; |
|
|
|
} |
|
|
|
saveExternalConnections = true; |
|
|
|
|
|
|
|
if (saveExternalConnections) |
|
|
|
{ |
|
|
|
@@ -1924,94 +1926,104 @@ bool CarlaEngine::loadProjectInternal(juce::XmlDocument& xmlDoc) |
|
|
|
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); |
|
|
|
|
|
|
|
// handle connections (internal) |
|
|
|
for (XmlElement* elem = xmlElement->getFirstChildElement(); elem != nullptr; elem = elem->getNextElement()) |
|
|
|
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) |
|
|
|
{ |
|
|
|
const String& tagName(elem->getTagName()); |
|
|
|
for (XmlElement* elem = xmlElement->getFirstChildElement(); elem != nullptr; elem = elem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& tagName(elem->getTagName()); |
|
|
|
|
|
|
|
if (! tagName.equalsIgnoreCase("patchbay")) |
|
|
|
continue; |
|
|
|
if (! tagName.equalsIgnoreCase("patchbay")) |
|
|
|
continue; |
|
|
|
|
|
|
|
CarlaString sourcePort, targetPort; |
|
|
|
CarlaString sourcePort, targetPort; |
|
|
|
|
|
|
|
for (XmlElement* patchElem = elem->getFirstChildElement(); patchElem != nullptr; patchElem = patchElem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& patchTag(patchElem->getTagName()); |
|
|
|
for (XmlElement* patchElem = elem->getFirstChildElement(); patchElem != nullptr; patchElem = patchElem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& patchTag(patchElem->getTagName()); |
|
|
|
|
|
|
|
sourcePort.clear(); |
|
|
|
targetPort.clear(); |
|
|
|
sourcePort.clear(); |
|
|
|
targetPort.clear(); |
|
|
|
|
|
|
|
if (! patchTag.equalsIgnoreCase("connection")) |
|
|
|
continue; |
|
|
|
if (! patchTag.equalsIgnoreCase("connection")) |
|
|
|
continue; |
|
|
|
|
|
|
|
for (XmlElement* connElem = patchElem->getFirstChildElement(); connElem != nullptr; connElem = connElem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& tag(connElem->getTagName()); |
|
|
|
const String text(connElem->getAllSubText().trim()); |
|
|
|
for (XmlElement* connElem = patchElem->getFirstChildElement(); connElem != nullptr; connElem = connElem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& tag(connElem->getTagName()); |
|
|
|
const String text(connElem->getAllSubText().trim()); |
|
|
|
|
|
|
|
/**/ if (tag.equalsIgnoreCase("source")) |
|
|
|
sourcePort = text.toRawUTF8(); |
|
|
|
else if (tag.equalsIgnoreCase("target")) |
|
|
|
targetPort = text.toRawUTF8(); |
|
|
|
} |
|
|
|
/**/ if (tag.equalsIgnoreCase("source")) |
|
|
|
sourcePort = text.toRawUTF8(); |
|
|
|
else if (tag.equalsIgnoreCase("target")) |
|
|
|
targetPort = text.toRawUTF8(); |
|
|
|
} |
|
|
|
|
|
|
|
if (sourcePort.isNotEmpty() && targetPort.isNotEmpty()) |
|
|
|
restorePatchbayConnection(false, sourcePort, targetPort); |
|
|
|
if (sourcePort.isNotEmpty() && targetPort.isNotEmpty()) |
|
|
|
restorePatchbayConnection(false, sourcePort, targetPort); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); |
|
|
|
|
|
|
|
// if we're running inside some session-manager, let them handle the external connections |
|
|
|
if (pData->options.processMode != ENGINE_PROCESS_MODE_PATCHBAY) |
|
|
|
{ |
|
|
|
/**/ if (std::getenv("CARLA_DONT_MANAGE_CONNECTIONS") != nullptr) |
|
|
|
return true; |
|
|
|
else if (std::getenv("LADISH_APP_NAME") != nullptr) |
|
|
|
return true; |
|
|
|
else if (std::getenv("NSM_URL") != nullptr) |
|
|
|
return true; |
|
|
|
else if (std::strcmp(getCurrentDriverName(), "Plugin") == 0) |
|
|
|
return true; |
|
|
|
} |
|
|
|
// if we're running inside some session-manager (and using JACK), let them handle the external connections |
|
|
|
bool loadExternalConnections; |
|
|
|
|
|
|
|
/**/ if (std::strcmp(getCurrentDriverName(), "Plugin") == 0) |
|
|
|
loadExternalConnections = false; |
|
|
|
else if (std::strcmp(getCurrentDriverName(), "JACK") != 0) |
|
|
|
loadExternalConnections = true; |
|
|
|
else if (std::getenv("CARLA_DONT_MANAGE_CONNECTIONS") != nullptr) |
|
|
|
loadExternalConnections = false; |
|
|
|
else if (std::getenv("LADISH_APP_NAME") != nullptr) |
|
|
|
loadExternalConnections = false; |
|
|
|
else if (std::getenv("NSM_URL") != nullptr) |
|
|
|
loadExternalConnections = false; |
|
|
|
else |
|
|
|
loadExternalConnections = true; |
|
|
|
|
|
|
|
// handle connections (external) |
|
|
|
for (XmlElement* elem = xmlElement->getFirstChildElement(); elem != nullptr; elem = elem->getNextElement()) |
|
|
|
if (loadExternalConnections) |
|
|
|
{ |
|
|
|
const String& tagName(elem->getTagName()); |
|
|
|
for (XmlElement* elem = xmlElement->getFirstChildElement(); elem != nullptr; elem = elem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& tagName(elem->getTagName()); |
|
|
|
|
|
|
|
if (! tagName.equalsIgnoreCase("externalpatchbay")) |
|
|
|
continue; |
|
|
|
if (! tagName.equalsIgnoreCase("externalpatchbay")) |
|
|
|
continue; |
|
|
|
|
|
|
|
CarlaString sourcePort, targetPort; |
|
|
|
carla_stdout("%s", tagName.toRawUTF8()); |
|
|
|
|
|
|
|
for (XmlElement* patchElem = elem->getFirstChildElement(); patchElem != nullptr; patchElem = patchElem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& patchTag(patchElem->getTagName()); |
|
|
|
CarlaString sourcePort, targetPort; |
|
|
|
|
|
|
|
sourcePort.clear(); |
|
|
|
targetPort.clear(); |
|
|
|
for (XmlElement* patchElem = elem->getFirstChildElement(); patchElem != nullptr; patchElem = patchElem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& patchTag(patchElem->getTagName()); |
|
|
|
|
|
|
|
if (! patchTag.equalsIgnoreCase("connection")) |
|
|
|
continue; |
|
|
|
sourcePort.clear(); |
|
|
|
targetPort.clear(); |
|
|
|
|
|
|
|
for (XmlElement* connElem = patchElem->getFirstChildElement(); connElem != nullptr; connElem = connElem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& tag(connElem->getTagName()); |
|
|
|
const String text(connElem->getAllSubText().trim()); |
|
|
|
if (! patchTag.equalsIgnoreCase("connection")) |
|
|
|
continue; |
|
|
|
|
|
|
|
/**/ if (tag.equalsIgnoreCase("source")) |
|
|
|
sourcePort = text.toRawUTF8(); |
|
|
|
else if (tag.equalsIgnoreCase("target")) |
|
|
|
targetPort = text.toRawUTF8(); |
|
|
|
} |
|
|
|
for (XmlElement* connElem = patchElem->getFirstChildElement(); connElem != nullptr; connElem = connElem->getNextElement()) |
|
|
|
{ |
|
|
|
const String& tag(connElem->getTagName()); |
|
|
|
const String text(connElem->getAllSubText().trim()); |
|
|
|
|
|
|
|
if (sourcePort.isNotEmpty() && targetPort.isNotEmpty()) |
|
|
|
restorePatchbayConnection(true, sourcePort, targetPort); |
|
|
|
/**/ if (tag.equalsIgnoreCase("source")) |
|
|
|
sourcePort = text.toRawUTF8(); |
|
|
|
else if (tag.equalsIgnoreCase("target")) |
|
|
|
targetPort = text.toRawUTF8(); |
|
|
|
} |
|
|
|
|
|
|
|
if (sourcePort.isNotEmpty() && targetPort.isNotEmpty()) |
|
|
|
restorePatchbayConnection(true, sourcePort, targetPort); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
return true; |
|
|
|
|