Skip to content

Commit

Permalink
exec: try a better implementation of CustomFloatControl
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Dec 1, 2024
1 parent c8ff9da commit 73407d2
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/plugins/score-plugin-avnd/Crousti/Concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ struct CustomFloatControlBase : public Process::ControlInlet

auto getMin() const noexcept { return domain().get().template convert_min<float>(); }
auto getMax() const noexcept { return domain().get().template convert_max<float>(); }

void setupExecution(ossia::inlet& inl) const noexcept override
{
auto& port = **safe_cast<ossia::value_inlet*>(&inl);
port.type = ossia::val_type::FLOAT;
port.domain = domain().get();
}
};

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

~CustomFloatControl() = default;

void setupExecution(ossia::inlet& inl) const noexcept override
{
auto& port = **safe_cast<ossia::value_inlet*>(&inl);
port.type = ossia::val_type::FLOAT;
using inlet_type = avnd::input_introspection<Node>;
using port_type = inlet_type::template field_type<FieldIndex{}>;
if constexpr(avnd::has_range<port_type>)
{
static constexpr auto range = avnd::get_range<port_type>();
ossia::domain_base<float> dom;
dom.min = range.min;
dom.max = range.max;
port.domain = dom;
}
}
};

}
Expand Down

0 comments on commit 73407d2

Please sign in to comment.