Switch
Routes u1 when the control reaches the threshold and u2 otherwise.
Behavior
Section titled “Behavior”y = u1 when ctrl >= threshold; otherwise y = u2. Selection occurs independently at each sample.
| Direction | Name | Type |
|---|---|---|
| Input | u1 |
T |
| Input | ctrl |
f64 |
| Input | u2 |
T |
| Output | y |
T |
Parameters
Section titled “Parameters”| Name | Type | Default | Meaning |
|---|---|---|---|
T |
type (default f64) |
f64 |
Routed value type |
threshold |
f64 |
0.0 |
Control level selecting u1 |
T is the type shared by u1, u2, and y, and can be a scalar, array, or composite value; the
whole value is routed. ctrl and threshold stay f64 at every T.
Example
Section titled “Example”With threshold = 0, (u1, ctrl, u2) samples (10, 1, 20), (10, -1, 20) produce 10, 20.