-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Combine.hpp
49 lines (44 loc) · 1.23 KB
/
Combine.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include <cmath>
#include <halp/controls.hpp>
#include <halp/dynamic_port.hpp>
#include <halp/meta.hpp>
#include <ossia/network/value/value.hpp>
namespace ao
{
struct Combine
{
halp_meta(name, "Combine")
halp_meta(c_name, "avnd_combine")
halp_meta(author, "Jean-Michaël Celerier")
halp_meta(category, "Mapping")
halp_meta(description, "Combine N inputs in a list")
halp_meta(
manual_url, "https://ossia.io/score-docs/processes/mapping-utilities.html#combine")
halp_meta(uuid, "3bbf74cd-55c1-473f-a11c-25ffec5b5c71")
struct
{
struct : halp::spinbox_i32<"Control", halp::range{0, 1024, 1}>
{
static std::function<void(Combine&, int)> on_controller_interaction()
{
return [](Combine& object, int value) {
object.inputs.in_i.request_port_resize(value);
};
}
} controller;
// FIXME for this usecase we could have instead a placeholder type ?
halp::dynamic_port<halp::val_port<"Input {}", ossia::value>> in_i;
} inputs;
struct
{
halp::val_port<"Output", std::vector<ossia::value>> out;
} outputs;
void operator()()
{
outputs.out.value.clear();
for(auto& val : inputs.in_i.ports)
outputs.out.value.push_back(val.value);
}
};
}