1
0
Fork 0

Rename Buffer::iter_mut() to iter_samples()

Since there's also an iter_blocks(). This is consistent with the new
Block method.
This commit is contained in:
Robbert van der Helm 2022-03-09 20:11:37 +01:00
parent fcd0522a33
commit 3c5aff1ec6
5 changed files with 8 additions and 8 deletions

View file

@ -274,7 +274,7 @@ impl Plugin for Diopser {
let smoothing_interval = let smoothing_interval =
unnormalize_automation_precision(self.params.automation_precision.value); 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); self.maybe_update_filters(smoothing_interval);
// We can compute the filters for both channels at once. The SIMD version thus now only // We can compute the filters for both channels at once. The SIMD version thus now only

View file

@ -158,7 +158,7 @@ impl Plugin for Gain {
buffer: &mut Buffer, buffer: &mut Buffer,
_context: &mut impl ProcessContext, _context: &mut impl ProcessContext,
) -> ProcessStatus { ) -> ProcessStatus {
for channel_samples in buffer.iter_mut() { for channel_samples in buffer.iter_samples() {
let mut amplitude = 0.0; let mut amplitude = 0.0;
let num_samples = channel_samples.len(); let num_samples = channel_samples.len();

View file

@ -125,7 +125,7 @@ impl Plugin for Gain {
buffer: &mut Buffer, buffer: &mut Buffer,
_context: &mut impl ProcessContext, _context: &mut impl ProcessContext,
) -> ProcessStatus { ) -> ProcessStatus {
for channel_samples in buffer.iter_mut() { for channel_samples in buffer.iter_samples() {
// Smoothing is optionally built into the parameters themselves // Smoothing is optionally built into the parameters themselves
let gain = self.params.gain.smoothed.next(); let gain = self.params.gain.smoothed.next();

View file

@ -133,7 +133,7 @@ impl Plugin for Sine {
fn process(&mut self, buffer: &mut Buffer, context: &mut impl ProcessContext) -> ProcessStatus { fn process(&mut self, buffer: &mut Buffer, context: &mut impl ProcessContext) -> ProcessStatus {
let mut next_event = context.next_midi_event(); 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 // Smoothing is optionally built into the parameters themselves
let gain = self.params.gain.smoothed.next(); let gain = self.params.gain.smoothed.next();

View file

@ -290,7 +290,7 @@ impl<'a> Buffer<'a> {
/// Iterate over the samples, returning a channel iterator for each sample. /// Iterate over the samples, returning a channel iterator for each sample.
#[inline] #[inline]
pub fn iter_mut<'slice>(&'slice mut self) -> SamplesIter<'slice, 'a> { pub fn iter_samples<'slice>(&'slice mut self) -> SamplesIter<'slice, 'a> {
SamplesIter { SamplesIter {
buffers: self.output_slices.as_mut_slice(), buffers: self.output_slices.as_mut_slice(),
current_sample: 0, 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 /// 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] #[inline]
pub fn iter_samples(&mut self) -> SamplesIter<'slice, 'sample> { pub fn iter_samples(&mut self) -> SamplesIter<'slice, 'sample> {
SamplesIter { SamplesIter {
@ -703,13 +703,13 @@ mod miri {
}) })
}; };
for samples in buffer.iter_mut() { for samples in buffer.iter_samples() {
for sample in samples { for sample in samples {
*sample += 0.001; *sample += 0.001;
} }
} }
for mut samples in buffer.iter_mut() { for mut samples in buffer.iter_samples() {
for _ in 0..2 { for _ in 0..2 {
for sample in samples.iter_mut() { for sample in samples.iter_mut() {
*sample += 0.001; *sample += 0.001;