diff options
Diffstat (limited to 'src/libs/client')
-rw-r--r-- | src/libs/client/Store.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 304056a3..f972c3ef 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -447,16 +447,23 @@ Store::control_change_event(const Path& port_path, float value) SharedPtr<PatchModel> Store::connection_patch(const Path& src_port_path, const Path& dst_port_path) { + SharedPtr<PatchModel> patch; + // Connection between patch ports - if (src_port_path.parent() == dst_port_path.parent()) { - SharedPtr<PatchModel> patch = PtrCast<PatchModel>(this->object(src_port_path.parent())); - if (patch) - return patch; - } + if (src_port_path.parent() == dst_port_path.parent()) + patch = PtrCast<PatchModel>(this->object(src_port_path.parent())); + else if (src_port_path.parent() == dst_port_path.parent().parent()) + patch = PtrCast<PatchModel>(this->object(src_port_path.parent())); + else if (src_port_path.parent().parent() == dst_port_path.parent()) + patch = PtrCast<PatchModel>(this->object(dst_port_path.parent())); + else + patch = PtrCast<PatchModel>(this->object(src_port_path.parent().parent())); + + if (!patch) + cerr << "ERROR: Unable to find connection patch " << src_port_path + << " -> " << dst_port_path << endl; - // Normal connection - assert(src_port_path.parent().parent() == dst_port_path.parent().parent()); - return PtrCast<PatchModel>(this->object(src_port_path.parent().parent())); + return patch; } |