21#ifndef SBL_CONTROL_MERGE_HPP_
22#define SBL_CONTROL_MERGE_HPP_
39 static_assert(
N > 0,
"Priority needs at least one source");
49 float value()
const {
return value_; }
59 winner_ =
static_cast<int8_t>(
i);
86 static_assert(
N > 0,
"Latest needs at least one source");
109 float value()
const {
return value_; }
152 const float d =
source - value_;
153 const bool above =
d > 0.0f;
154 const bool within = (
d <= window_) && (
d >= -window_);
170 float value()
const {
return value_; }
180 bool side_known_ =
false;
The last source to move wins.
void write(uint8_t source, float value)
void update(uint8_t source, float value)
Latest(float threshold=0.001f)
int8_t owner() const
Source that wrote last, or -1 before any write.
A takeover source must reach the held value before it captures it.
Pickup(float window=0.01f)
float process(float source)
Feed the takeover source (every tick). Returns the parameter value.
void release()
Hand the parameter to the takeover source now (e.g. a panel reset).
bool caught() const
True while the takeover source drives the parameter.
void hold(float value)
Another source set the parameter; the takeover source must now reach it.
The highest-priority active source wins.
void set(uint8_t source, float value, bool active)
int8_t winner() const
Winning source index, or -1 if none is active (value() is holding).
Control Stack v2: scheduler, event queue, merge, CC mapping, calibration, presets.