2#include <ossia/detail/config.hpp>
4#include <ossia/dataflow/graph_node.hpp>
5#include <ossia/dataflow/port.hpp>
6#include <ossia/detail/optional.hpp>
9#include <ossia/editor/mapper/detail/mapper_visitor.hpp>
12template <
typename Y,
typename Easing>
15 Y operator()(
double ratio, Y start, Y end)
const
17 return easing::ease{}(start, end, Easing{}(ratio));
23class OSSIA_EXPORT simple_mapping final :
public ossia::nonowning_graph_node
28 m_inlets.push_back(&value_in);
29 m_inlets.push_back(&input_min);
30 m_inlets.push_back(&input_max);
31 m_inlets.push_back(&output_min);
32 m_inlets.push_back(&output_max);
33 m_inlets.push_back(&curve_in);
34 m_outlets.push_back(&value_out);
37 std::string label() const noexcept
override {
return "simple_mapping"; }
39 ~simple_mapping()
override { }
42 void run(
const ossia::token_request& t, ossia::exec_state_facade e)
noexcept override
48 for(
auto& tv : value_in.get_data())
53 = ossia::apply(ossia::detail::mapper_compute_visitor{}, tv.value, m_drive.v);
55 op.write_value(std::move(v), tv.timestamp);
60 ossia::behavior m_drive;
62 ossia::value_inlet value_in;
63 ossia::value_inlet input_min;
64 ossia::value_inlet input_max;
65 ossia::value_inlet output_min;
66 ossia::value_inlet output_max;
67 ossia::value_inlet curve_kind;
69 ossia::value_outlet value_out;
72 = float (*)(
float in,
float min_in,
float max_in,
float min_out,
float max_out);
73 ossia::flat_map<std::string, map_func> m_funcs;