From 3c5aff1ec6e7df50940f924076be4605575b5579 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 9 Mar 2022 20:11:37 +0100 Subject: [PATCH] Rename Buffer::iter_mut() to iter_samples() Since there's also an iter_blocks(). This is consistent with the new Block method. --- plugins/diopser/src/lib.rs | 2 +- plugins/examples/gain-gui/src/lib.rs | 2 +- plugins/examples/gain/src/lib.rs | 2 +- plugins/examples/sine/src/lib.rs | 2 +- src/buffer.rs | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/diopser/src/lib.rs b/plugins/diopser/src/lib.rs index 023e19b9..06114a17 100644 --- a/plugins/diopser/src/lib.rs +++ b/plugins/diopser/src/lib.rs @@ -274,7 +274,7 @@ impl Plugin for Diopser { let smoothing_interval = unnormalize_automation_precision(self.params.automation_precision.value); - for mut channel_samples in buffer.iter_mut() { + for mut channel_samples in buffer.iter_samples() { self.maybe_update_filters(smoothing_interval); // We can compute the filters for both channels at once. The SIMD version thus now only diff --git a/plugins/examples/gain-gui/src/lib.rs b/plugins/examples/gain-gui/src/lib.rs index 7dea77f7..d830c0aa 100644 --- a/plugins/examples/gain-gui/src/lib.rs +++ b/plugins/examples/gain-gui/src/lib.rs @@ -158,7 +158,7 @@ impl Plugin for Gain { buffer: &mut Buffer, _context: &mut impl ProcessContext, ) -> ProcessStatus { - for channel_samples in buffer.iter_mut() { + for channel_samples in buffer.iter_samples() { let mut amplitude = 0.0; let num_samples = channel_samples.len(); diff --git a/plugins/examples/gain/src/lib.rs b/plugins/examples/gain/src/lib.rs index d55518c5..949e0930 100644 --- a/plugins/examples/gain/src/lib.rs +++ b/plugins/examples/gain/src/lib.rs @@ -125,7 +125,7 @@ impl Plugin for Gain { buffer: &mut Buffer, _context: &mut impl ProcessContext, ) -> ProcessStatus { - for channel_samples in buffer.iter_mut() { + for channel_samples in buffer.iter_samples() { // Smoothing is optionally built into the parameters themselves let gain = self.params.gain.smoothed.next(); diff --git a/plugins/examples/sine/src/lib.rs b/plugins/examples/sine/src/lib.rs index 57b4ec5d..e7de6580 100644 --- a/plugins/examples/sine/src/lib.rs +++ b/plugins/examples/sine/src/lib.rs @@ -133,7 +133,7 @@ impl Plugin for Sine { fn process(&mut self, buffer: &mut Buffer, context: &mut impl ProcessContext) -> ProcessStatus { let mut next_event = context.next_midi_event(); - for (sample_id, channel_samples) in buffer.iter_mut().enumerate() { + for (sample_id, channel_samples) in buffer.iter_samples().enumerate() { // Smoothing is optionally built into the parameters themselves let gain = self.params.gain.smoothed.next(); diff --git a/src/buffer.rs b/src/buffer.rs index 5b8264b8..39332dcf 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -290,7 +290,7 @@ impl<'a> Buffer<'a> { /// Iterate over the samples, returning a channel iterator for each sample. #[inline] - pub fn iter_mut<'slice>(&'slice mut self) -> SamplesIter<'slice, 'a> { + pub fn iter_samples<'slice>(&'slice mut self) -> SamplesIter<'slice, 'a> { SamplesIter { buffers: self.output_slices.as_mut_slice(), current_sample: 0, @@ -511,7 +511,7 @@ impl<'slice, 'sample> Block<'slice, 'sample> { } /// Iterate over this block on a per-sample per-channel basis. This is identical to - /// [`Buffer::iter_mut()`] but for a smaller block instead of the entire buffer + /// [`Buffer::iter_samples()`] but for a smaller block instead of the entire buffer #[inline] pub fn iter_samples(&mut self) -> SamplesIter<'slice, 'sample> { SamplesIter { @@ -703,13 +703,13 @@ mod miri { }) }; - for samples in buffer.iter_mut() { + for samples in buffer.iter_samples() { for sample in samples { *sample += 0.001; } } - for mut samples in buffer.iter_mut() { + for mut samples in buffer.iter_samples() { for _ in 0..2 { for sample in samples.iter_mut() { *sample += 0.001;