Skip to content

Commit 1a3c0a5

Browse files
committed
exec: try a better implementation of CustomFloatControl
1 parent dc29b2f commit 1a3c0a5

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/plugins/score-plugin-avnd/Crousti/Concepts.hpp

+16-7
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ struct CustomFloatControlBase : public Process::ControlInlet
6666

6767
auto getMin() const noexcept { return domain().get().template convert_min<float>(); }
6868
auto getMax() const noexcept { return domain().get().template convert_max<float>(); }
69-
70-
void setupExecution(ossia::inlet& inl) const noexcept override
71-
{
72-
auto& port = **safe_cast<ossia::value_inlet*>(&inl);
73-
port.type = ossia::val_type::FLOAT;
74-
port.domain = domain().get();
75-
}
7669
};
7770

7871
template <typename Node, typename FieldIndex>
@@ -92,6 +85,22 @@ struct CustomFloatControl : public CustomFloatControlBase
9285
}
9386

9487
~CustomFloatControl() = default;
88+
89+
void setupExecution(ossia::inlet& inl) const noexcept override
90+
{
91+
auto& port = **safe_cast<ossia::value_inlet*>(&inl);
92+
port.type = ossia::val_type::FLOAT;
93+
using inlet_type = avnd::input_introspection<Node>;
94+
using port_type = inlet_type::template field_type<FieldIndex{}>;
95+
if constexpr(avnd::has_range<port_type>)
96+
{
97+
static constexpr auto range = avnd::get_range<port_type>();
98+
ossia::domain_base<float> dom;
99+
dom.min = range.min;
100+
dom.max = range.max;
101+
port.domain = dom;
102+
}
103+
}
95104
};
96105

97106
}

0 commit comments

Comments
 (0)