2 #include <Fx/MathMapping_generic.hpp>
3 #include <Fx/Types.hpp>
5 #include <ossia/dataflow/value_port.hpp>
7 #include <boost/container/static_vector.hpp>
9 #include <halp/layout.hpp>
11 namespace Nodes::ArrayMapping
15 halp_meta(name,
"Arraymap")
16 halp_meta(c_name,
"ArrayMapping")
17 halp_meta(category,
"Control/Mappings")
19 manual_url,
"https://ossia.io/score-docs/processes/exprtk.html#array-handling")
20 halp_meta(author,
"ossia score, ExprTK (Arash Partow)")
21 halp_meta(description,
"Applies a math expression to each member of an input.");
22 halp_meta(uuid,
"1fe9c806-b601-4ee0-9fbb-0ab817c4dd87");
26 struct : halp::val_port<
"in", ossia::value>
29 halp_flag(active_port);
31 halp::lineedit<
"Expression",
"x"> expr;
43 void init(
double& cur_time,
double& cur_deltatime,
double& cur_pos)
45 expr.add_variable(
"i", instance);
47 expr.add_variable(
"x", x);
48 expr.add_variable(
"px", px);
49 expr.add_variable(
"po", po);
51 expr.add_variable(
"t", cur_time);
52 expr.add_variable(
"dt", cur_deltatime);
53 expr.add_variable(
"pos", cur_pos);
56 expr.register_symbol_table();
64 ossia::math_expression expr;
67 boost::container::static_vector<Expr, 1024> expressions;
69 double cur_deltatime{};
72 int64_t last_value_time{};
73 std::string last_expression;
76 using tick = halp::tick_flicks;
78 void operator()(
const tick& tk)
80 GenericMathMapping<State>::run_polyphonic(
81 inputs.port.value, outputs.port.call, inputs.expr.value, tk, state);
86 halp_meta(layout, halp::layouts::vbox)
88 struct : halp::control<&ins::expr>
90 halp_flag(dynamic_size);
Utilities for OSSIA data structures.
Definition: DeviceInterface.hpp:33
Definition: Arraymap.hpp:42
Definition: Arraymap.hpp:25
Definition: Arraymap.hpp:85
Definition: Arraymap.hpp:14