pub fn numeric_per_sample<I: IntoIterator<Item = PiecewiseLinearCurvePoint, IntoIter: Clone>>(
state: NumericBufferState<I>,
) -> impl Iterator<Item = f32> + Clone
Expand description
Converts a NumericBufferState
into a per-sample iterator.
This provides the value of the parameter at each sample in the buffer.
ยงExample
let state = NumericBufferState::PiecewiseLinear(PiecewiseLinearCurve::new(
vec![
PiecewiseLinearCurvePoint { sample_offset: 0, value: 0.0 },
PiecewiseLinearCurvePoint { sample_offset: 10, value: 1.0 },
],
13,
0.0..=1.0,
).unwrap());
assert!(
all_approx_eq(
numeric_per_sample(state),
[0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.0, 1.0],
1e-6
)
);