20 halp_meta(name,
"Rendezvous")
21 halp_meta(c_name,
"avnd_rendezvous")
22 halp_meta(author,
"ossia team")
23 halp_meta(category,
"Control/Mappings")
24 halp_meta(description,
"Emit an ordered list when every input has a fresh event")
25 halp_meta(uuid,
"ec5529c6-4c69-47bd-9eb7-3bfbc3cc5ccf")
31 halp_meta(name,
"Input {}")
32 ossia::value_port* value{};
33 static constexpr bool is_event() {
return true; }
38 struct : halp::spinbox_i32<
"Input count", halp::range{0, 512, 2}>
40 static std::function<void(
Rendezvous&,
int)> on_controller_interaction()
43 object.inputs.in_i.request_port_resize(std::clamp(value, 0, 512));
47 void update(Rendezvous&
object)
49 const int count = std::clamp(this->value, 0, 512);
50 if(count !=
object.requested_count)
52 object.requested_count = count;
58 struct : halp::toggle<
"Keep first">
62 "Keep the first fresh value on each input until the cycle completes. "
63 "When disabled, keep the latest value. Changes affect future arrivals.")
66 halp::dynamic_port<Input> in_i;
67 halp::impulse_button<
"Clear"> clear;
72 halp::callback<
"Output",
const std::vector<ossia::value>&> out;
74 halp::val_port<
"Waiting",
int> waiting;
79 const auto count = inputs.in_i.ports.size();
80 if(pending.size() != count)
82 pending.resize(count);
83 received.resize(count);
88 if(inputs.clear.value)
90 inputs.clear.value.reset();
95 for(std::size_t i = 0; i < count; ++i)
97 const auto* input = inputs.in_i.ports[i].value;
98 if(!input || input->get_data().empty())
100 if(!received[i] || !inputs.keep_first.value)
102 const auto& arrivals = input->get_data();
104 = inputs.keep_first.value ? arrivals.front().value : arrivals.back().value;
113 outputs.waiting.value =
static_cast<int>(count - ready_count);
114 if(count != 0 && ready_count == count)
118 outputs.out(pending);
124 int requested_count = 2;
125 std::vector<ossia::value> pending;
126 std::vector<bool> received;
127 std::size_t ready_count{};
131 for(
auto& value : pending)
132 value = ossia::value{};
133 std::fill(received.begin(), received.end(),
false);
135 outputs.waiting.value =
static_cast<int>(inputs.in_i.ports.size());
138 void clear() { reset_cycle(); }