1
0
Fork 0

Change sample iterator variable names in examples

This commit is contained in:
Robbert van der Helm 2022-03-03 21:38:50 +01:00
parent 8acebadac0
commit 6c9db8fee8
3 changed files with 7 additions and 7 deletions

View file

@ -163,12 +163,12 @@ impl Plugin for Gain {
buffer: &mut Buffer, buffer: &mut Buffer,
_context: &mut impl ProcessContext, _context: &mut impl ProcessContext,
) -> ProcessStatus { ) -> ProcessStatus {
for samples in buffer.iter_mut() { for channel_samples in buffer.iter_mut() {
let mut amplitude = 0.0; let mut amplitude = 0.0;
let num_samples = samples.len(); let num_samples = channel_samples.len();
let gain = self.params.gain.smoothed.next(); let gain = self.params.gain.smoothed.next();
for sample in samples { for sample in channel_samples {
*sample *= util::db_to_gain(gain); *sample *= util::db_to_gain(gain);
amplitude += *sample; amplitude += *sample;
} }

View file

@ -139,11 +139,11 @@ impl Plugin for Gain {
buffer: &mut Buffer, buffer: &mut Buffer,
_context: &mut impl ProcessContext, _context: &mut impl ProcessContext,
) -> ProcessStatus { ) -> ProcessStatus {
for samples in buffer.iter_mut() { for channel_samples in buffer.iter_mut() {
// 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();
for sample in samples { for sample in channel_samples {
*sample *= util::db_to_gain(gain); *sample *= util::db_to_gain(gain);
} }
} }

View file

@ -134,7 +134,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, samples) in buffer.iter_mut().enumerate() { for (sample_id, channel_samples) in buffer.iter_mut().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();
@ -167,7 +167,7 @@ impl Plugin for Sine {
self.calculate_sine(frequency) self.calculate_sine(frequency)
}; };
for sample in samples { for sample in channel_samples {
*sample = sine * util::db_to_gain(gain); *sample = sine * util::db_to_gain(gain);
} }
} }