conformal_component::audio

Function channels_mut

Source
pub fn channels_mut<B: BufferMut>(
    buffer: &mut B,
) -> impl Iterator<Item = &mut [f32]>
Expand description

Returns an iterator for the channels of a mutable buffer.

The items of this iterator will be mutable slices of the samples of each channel.

ยงExamples

let mut buffer = BufferData::new_mono(vec![1.0, 2.0, 3.0]);
for channel in channels_mut(&mut buffer) {
   for sample in channel {
     *sample *= 2.0;
   }
}
assert_eq!(buffer.channel(0), [2.0, 4.0, 6.0]);