Skip to content

Commit a331729

Browse files
committed
small clean up
1 parent 1bc1685 commit a331729

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

playback/src/config.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,20 @@ impl SampleRate {
180180
mut coefficients: Vec<f64>,
181181
resample_factor_reciprocal: f64,
182182
) -> Vec<f64> {
183-
let mut coefficient_sum = 0.0;
183+
let mut coefficients_sum = 0.0;
184184

185-
for (index, coefficient) in coefficients.iter_mut().enumerate() {
186-
*coefficient *= Self::sinc((index as f64 * resample_factor_reciprocal).fract());
185+
coefficients
186+
.iter_mut()
187+
.enumerate()
188+
.for_each(|(index, coefficient)| {
189+
*coefficient *= Self::sinc((index as f64 * resample_factor_reciprocal).fract());
187190

188-
coefficient_sum += *coefficient;
189-
}
191+
coefficients_sum += *coefficient;
192+
});
190193

191194
coefficients
192195
.iter_mut()
193-
.for_each(|coefficient| *coefficient /= coefficient_sum);
196+
.for_each(|coefficient| *coefficient /= coefficients_sum);
194197

195198
coefficients
196199
}

playback/src/resampler.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,14 @@ impl StereoInterleavedResampler {
296296
// The player increments the player id when it gets it...
297297
let player_id = PLAYER_COUNTER.load(Ordering::SeqCst).saturating_sub(1);
298298

299-
let left_thread_name = format!("resampler:{player_id}:left");
300-
let right_thread_name = format!("resampler:{player_id}:right");
301-
302299
Resampler::Worker {
303300
left_resampler: ResampleWorker::new(
304301
MonoSincResampler::new(sample_rate),
305-
left_thread_name,
302+
format!("resampler:{player_id}:left"),
306303
),
307304
right_resampler: ResampleWorker::new(
308305
MonoSincResampler::new(sample_rate),
309-
right_thread_name,
306+
format!("resampler:{player_id}:right"),
310307
),
311308
}
312309
}

0 commit comments

Comments
 (0)