13 halp_meta(name,
"Micromap")
14 halp_meta(c_name,
"MicroMapping")
15 halp_meta(category,
"Control/Mappings")
17 manual_url,
"https://ossia.io/score-docs/processes/exprtk.html#exprtk-support")
18 halp_meta(author,
"ossia score, ExprTK (Arash Partow)")
19 halp_meta(description,
"Applies a math expression to an input.")
20 halp_meta(uuid,
"25c64b87-a44a-4fed-9f60-0a48906fd3ec")
24 struct : halp::val_port<
"in", ossia::value>
28 halp_flag(active_port);
29 void update(
Node& self) { self.trigger =
true; }
31 halp::lineedit<
"Expression",
"x / 127"> expr;
46 expr.add_vector(
"xv", xv);
47 expr.add_vector(
"pxv", pxv);
48 expr.add_vector(
"pov", pov);
50 expr.add_variable(
"x", x);
51 expr.add_variable(
"px", px);
52 expr.add_variable(
"po", po);
54 expr.add_variable(
"t", cur_time);
55 expr.add_variable(
"dt", cur_deltatime);
56 expr.add_variable(
"pos", cur_pos);
59 expr.register_symbol_table();
62 std::vector<double> xv;
63 std::vector<double> pxv;
64 std::vector<double> pov;
71 double cur_deltatime{};
74 ossia::math_expression expr;
75 int64_t last_value_time{};
82 void prepare(halp::setup s) { setup = s; }
84 using tick = halp::tick_flicks;
86 void operator()(
const tick& tk)
88 if(!std::exchange(trigger,
false))
90 auto& self = this->state;
91 if(!self.expr.set_expression(this->inputs.expr))
94 if(self.expr.has_variable(
"xv"))
96 inputs.port.value, outputs.port.call, tk, state);
99 inputs.port.value, outputs.port.call, tk, state);
104 halp_meta(layout, halp::layouts::vbox)
106 struct : halp::control<&ins::expr>
108 halp_flag(dynamic_size);