Browse Source

Continue

tags/1.9.6
falkTX 11 years ago
parent
commit
13a09e56a6
2 changed files with 101 additions and 87 deletions
  1. +86
    -74
      source/backend/engine/CarlaEngine.cpp
  2. +15
    -13
      source/backend/engine/CarlaEngineGraph.cpp

+ 86
- 74
source/backend/engine/CarlaEngine.cpp View File

@@ -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;


+ 15
- 13
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -533,7 +533,7 @@ void RackGraph::refresh(const char* const deviceName)
{
const uint& portId(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(portId != 0);
CARLA_SAFE_ASSERT_CONTINUE(portId < audioPorts.ins.count());
CARLA_SAFE_ASSERT_CONTINUE(portId <= audioPorts.ins.count()); // FIXME <=

ConnectionToId connectionToId;
connectionToId.setData(++(connections.lastId), RACK_GRAPH_GROUP_AUDIO_IN, portId, RACK_GRAPH_GROUP_CARLA, RACK_GRAPH_CARLA_PORT_AUDIO_IN1);
@@ -549,7 +549,7 @@ void RackGraph::refresh(const char* const deviceName)
{
const uint& portId(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(portId != 0);
CARLA_SAFE_ASSERT_CONTINUE(portId < audioPorts.ins.count());
CARLA_SAFE_ASSERT_CONTINUE(portId <= audioPorts.ins.count()); // FIXME <=

ConnectionToId connectionToId;
connectionToId.setData(++(connections.lastId), RACK_GRAPH_GROUP_AUDIO_IN, portId, RACK_GRAPH_GROUP_CARLA, RACK_GRAPH_CARLA_PORT_AUDIO_IN2);
@@ -565,7 +565,7 @@ void RackGraph::refresh(const char* const deviceName)
{
const uint& portId(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(portId != 0);
CARLA_SAFE_ASSERT_CONTINUE(portId < audioPorts.outs.count());
CARLA_SAFE_ASSERT_CONTINUE(portId <= audioPorts.outs.count()); // FIXME <=

ConnectionToId connectionToId;
connectionToId.setData(++(connections.lastId), RACK_GRAPH_GROUP_CARLA, RACK_GRAPH_CARLA_PORT_AUDIO_OUT1, RACK_GRAPH_GROUP_AUDIO_OUT, portId);
@@ -581,7 +581,7 @@ void RackGraph::refresh(const char* const deviceName)
{
const uint& portId(it.getValue(0));
CARLA_SAFE_ASSERT_CONTINUE(portId != 0);
CARLA_SAFE_ASSERT_CONTINUE(portId < audioPorts.outs.count());
CARLA_SAFE_ASSERT_CONTINUE(portId <= audioPorts.outs.count()); // FIXME <=

ConnectionToId connectionToId;
connectionToId.setData(++(connections.lastId), RACK_GRAPH_GROUP_CARLA, RACK_GRAPH_CARLA_PORT_AUDIO_OUT2, RACK_GRAPH_GROUP_AUDIO_OUT, portId);
@@ -700,7 +700,7 @@ bool RackGraph::getGroupAndPortIdFromFullName(const char* const fullPortName, ui
{
groupId = RACK_GRAPH_GROUP_AUDIO_OUT;

if (const char* const portName = fullPortName+8)
if (const char* const portName = fullPortName+9)
{
bool ok;
portId = audioPorts.getPortId(false, portName, &ok);
@@ -2127,15 +2127,18 @@ const char* const* CarlaEngine::getPatchbayConnections(const bool external) cons

if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK)
{
if (external)
return nullptr;
if (RackGraph* const graph = pData->graph.getRackGraph())
return graph->getConnections();
RackGraph* const graph = pData->graph.getRackGraph();
CARLA_SAFE_ASSERT_RETURN(graph != nullptr, nullptr);
CARLA_SAFE_ASSERT_RETURN(external, nullptr);

return graph->getConnections();
}
else
{
if (PatchbayGraph* const graph = pData->graph.getPatchbayGraph())
return graph->getConnections(external);
PatchbayGraph* const graph = pData->graph.getPatchbayGraph();
CARLA_SAFE_ASSERT_RETURN(graph != nullptr, nullptr);

return graph->getConnections(external);
}

return nullptr;
@@ -2155,9 +2158,8 @@ void CarlaEngine::restorePatchbayConnection(const bool external, const char* con
{
RackGraph* const graph = pData->graph.getRackGraph();
CARLA_SAFE_ASSERT_RETURN(graph != nullptr,);
CARLA_SAFE_ASSERT_RETURN(external,);

if (external)
return;
if (! graph->getGroupAndPortIdFromFullName(sourcePort, groupA, portA))
return;
if (! graph->getGroupAndPortIdFromFullName(targetPort, groupB, portB))


Loading…
Cancel
Save