From 2f4c2afeffb1490210a49de946322a8c6f97f5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Sun, 22 Dec 2024 16:31:42 -0500 Subject: [PATCH] ossia: allow nodes to be aware of the ossia address --- include/avnd/binding/ossia/node.hpp | 1 + .../binding/ossia/port_run_preprocess.hpp | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/include/avnd/binding/ossia/node.hpp b/include/avnd/binding/ossia/node.hpp index 74d287b6..44ecd5ac 100644 --- a/include/avnd/binding/ossia/node.hpp +++ b/include/avnd/binding/ossia/node.hpp @@ -478,6 +478,7 @@ class safe_node_base : public safe_node_base_base this->frame_count_for_this_tick = frames; // Process inputs of all sorts + this->process_all_ports>(); this->process_all_ports>(start, frames); // Process messages diff --git a/include/avnd/binding/ossia/port_run_preprocess.hpp b/include/avnd/binding/ossia/port_run_preprocess.hpp index 95ce96d1..f505c1f7 100644 --- a/include/avnd/binding/ossia/port_run_preprocess.hpp +++ b/include/avnd/binding/ossia/port_run_preprocess.hpp @@ -13,10 +13,13 @@ #include #include #include +#include #include #include #include #include +#include +#include #include namespace oscr @@ -32,6 +35,31 @@ inline void update_value( } } +struct node_from_destination +{ + ossia::net::node_base* operator()(ossia::net::parameter_base* p) + { + if(p) + return &p->get_node(); + } + // ossia::traversal::path, ossia::net::node_base* +}; + +template +struct set_ossia_node_in_port +{ + Exec_T& self; + Obj_T& impl; + + inline void operator()(auto& ctrl, auto& port, auto) const noexcept + { + if constexpr(requires { ctrl.ossia_node = nullptr; }) + { + ctrl.ossia_node = impl.ossia_state.get_first_destination(port.address); + } + } +}; + template struct process_before_run {