From 3c1b303b8528187a54e1af9206d013d493260438 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 22 Feb 2015 18:25:44 +0000 Subject: [PATCH] Continue --- source/backend/engine/CarlaEngineGraph.cpp | 8 +++ source/backend/engine/CarlaEngineRtAudio.cpp | 60 ++++++++++++++++---- 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/source/backend/engine/CarlaEngineGraph.cpp b/source/backend/engine/CarlaEngineGraph.cpp index d5be34a1e..d037fa362 100644 --- a/source/backend/engine/CarlaEngineGraph.cpp +++ b/source/backend/engine/CarlaEngineGraph.cpp @@ -1564,6 +1564,9 @@ void PatchbayGraph::removeAllPlugins() bool PatchbayGraph::connect(const uint groupA, const uint portA, const uint groupB, const uint portB) noexcept { + if (usingExternal) + return extGraph.connect(groupA, portA, groupB, portB); + uint adjustedPortA = portA; uint adjustedPortB = portB; @@ -1593,6 +1596,9 @@ bool PatchbayGraph::connect(const uint groupA, const uint portA, const uint grou bool PatchbayGraph::disconnect(const uint connectionId) noexcept { + if (usingExternal) + return extGraph.disconnect(connectionId); + for (LinkedList::Itenerator it=connections.list.begin(); it.valid(); it.next()) { static const ConnectionToId fallback = { 0, 0, 0, 0, 0 }; @@ -1627,6 +1633,8 @@ bool PatchbayGraph::disconnect(const uint connectionId) noexcept void PatchbayGraph::disconnectGroup(const uint groupId) noexcept { + CARLA_SAFE_ASSERT(! usingExternal); + for (LinkedList::Itenerator it=connections.list.begin(); it.valid(); it.next()) { static const ConnectionToId fallback = { 0, 0, 0, 0, 0 }; diff --git a/source/backend/engine/CarlaEngineRtAudio.cpp b/source/backend/engine/CarlaEngineRtAudio.cpp index bdf000ef1..345c3dcf3 100644 --- a/source/backend/engine/CarlaEngineRtAudio.cpp +++ b/source/backend/engine/CarlaEngineRtAudio.cpp @@ -739,9 +739,18 @@ protected: CARLA_SAFE_ASSERT_RETURN(portName != nullptr && portName[0] != '\0', false); carla_debug("CarlaEngineRtAudio::connectRackMidiInPort(\"%s\")", portName); - RackGraph* const graph(pData->graph.getRackGraph()); - CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); - CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.ins.count() > 0, false); + if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) + { + RackGraph* const graph(pData->graph.getRackGraph()); + CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); + CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.ins.count() > 0, false); + } + else + { + PatchbayGraph* const graph(pData->graph.getPatchbayGraph()); + CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); + CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.ins.count() > 0, false); + } CarlaString newRtMidiPortName; newRtMidiPortName += getName(); @@ -794,9 +803,18 @@ protected: CARLA_SAFE_ASSERT_RETURN(portName != nullptr && portName[0] != '\0', false); carla_debug("CarlaEngineRtAudio::connectRackMidiOutPort(\"%s\")", portName); - RackGraph* const graph(pData->graph.getRackGraph()); - CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); - CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.ins.count() > 0, false); + if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) + { + RackGraph* const graph(pData->graph.getRackGraph()); + CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); + CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.outs.count() > 0, false); + } + else + { + PatchbayGraph* const graph(pData->graph.getPatchbayGraph()); + CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); + CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.outs.count() > 0, false); + } CarlaString newRtMidiPortName; newRtMidiPortName += getName(); @@ -849,9 +867,18 @@ protected: CARLA_SAFE_ASSERT_RETURN(portName != nullptr && portName[0] != '\0', false); carla_debug("CarlaEngineRtAudio::disconnectRackMidiInPort(\"%s\")", portName); - RackGraph* const graph(pData->graph.getRackGraph()); - CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); - CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.ins.count() > 0, false); + if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) + { + RackGraph* const graph(pData->graph.getRackGraph()); + CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); + CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.ins.count() > 0, false); + } + else + { + PatchbayGraph* const graph(pData->graph.getPatchbayGraph()); + CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); + CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.ins.count() > 0, false); + } for (LinkedList::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) { @@ -879,9 +906,18 @@ protected: CARLA_SAFE_ASSERT_RETURN(portName != nullptr && portName[0] != '\0', false); carla_debug("CarlaEngineRtAudio::disconnectRackMidiOutPort(\"%s\")", portName); - RackGraph* const graph(pData->graph.getRackGraph()); - CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); - CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.outs.count() > 0, false); + if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) + { + RackGraph* const graph(pData->graph.getRackGraph()); + CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); + CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.outs.count() > 0, false); + } + else + { + PatchbayGraph* const graph(pData->graph.getPatchbayGraph()); + CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); + CARLA_SAFE_ASSERT_RETURN(graph->extGraph.midiPorts.outs.count() > 0, false); + } const CarlaMutexLocker cml(fMidiOutMutex);