pub fn switch_per_sample<I: IntoIterator<Item = TimedValue<bool>, IntoIter: Clone>>(
state: SwitchBufferState<I>,
) -> impl Iterator<Item = bool> + Clone
Expand description
Converts a SwitchBufferState
into a per-sample iterator.
This provides the value of the parameter at each sample in the buffer.
ยงExample
let state = SwitchBufferState::Varying(TimedSwitchValues::new(
vec![
TimedValue { sample_offset: 0, value: false },
TimedValue { sample_offset: 3, value: true },
],
5,
).unwrap());
assert!(
switch_per_sample(state).eq([false, false, false, true, true].iter().cloned())
);