2 #include <Fx/MathMapping_generic.hpp>
3 #include <Fx/Types.hpp>
5 #include <ossia/dataflow/value_port.hpp>
7 #include <halp/layout.hpp>
9 namespace Nodes::MicroMapping
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>
27 halp_flag(active_port);
29 halp::lineedit<
"Expression",
"x / 127"> expr;
44 expr.add_vector(
"xv", xv);
45 expr.add_vector(
"pxv", pxv);
46 expr.add_vector(
"pov", pov);
48 expr.add_variable(
"x", x);
49 expr.add_variable(
"px", px);
50 expr.add_variable(
"po", po);
52 expr.add_variable(
"t", cur_time);
53 expr.add_variable(
"dt", cur_deltatime);
54 expr.add_variable(
"pos", cur_pos);
57 expr.register_symbol_table();
60 std::vector<double> xv;
61 std::vector<double> pxv;
62 std::vector<double> pov;
69 double cur_deltatime{};
72 ossia::math_expression expr;
73 int64_t last_value_time{};
79 void prepare(halp::setup s) { setup = s; }
81 using tick = halp::tick_flicks;
83 void operator()(
const tick& tk)
85 auto&
self = this->state;
86 if(!
self.expr.set_expression(this->inputs.expr))
89 if(
self.expr.has_variable(
"xv"))
91 inputs.port.value, outputs.port.call, tk, state);
94 inputs.port.value, outputs.port.call, tk, state);
99 halp_meta(layout, halp::layouts::vbox)
101 struct : halp::control<&ins::expr>
103 halp_flag(dynamic_size);
Utilities for OSSIA data structures.
Definition: DeviceInterface.hpp:33
Definition: MathMapping_generic.hpp:12
Definition: MicroMapping.hpp:98
Definition: MicroMapping.hpp:12