diff --git a/playback/src/config.rs b/playback/src/config.rs index e2fafda29..6f9eb2564 100644 --- a/playback/src/config.rs +++ b/playback/src/config.rs @@ -180,17 +180,20 @@ impl SampleRate { mut coefficients: Vec, resample_factor_reciprocal: f64, ) -> Vec { - let mut coefficient_sum = 0.0; + let mut coefficients_sum = 0.0; - for (index, coefficient) in coefficients.iter_mut().enumerate() { - *coefficient *= Self::sinc((index as f64 * resample_factor_reciprocal).fract()); + coefficients + .iter_mut() + .enumerate() + .for_each(|(index, coefficient)| { + *coefficient *= Self::sinc((index as f64 * resample_factor_reciprocal).fract()); - coefficient_sum += *coefficient; - } + coefficients_sum += *coefficient; + }); coefficients .iter_mut() - .for_each(|coefficient| *coefficient /= coefficient_sum); + .for_each(|coefficient| *coefficient /= coefficients_sum); coefficients } diff --git a/playback/src/resampler.rs b/playback/src/resampler.rs index fe82d4845..7642e44fe 100644 --- a/playback/src/resampler.rs +++ b/playback/src/resampler.rs @@ -296,17 +296,14 @@ impl StereoInterleavedResampler { // The player increments the player id when it gets it... let player_id = PLAYER_COUNTER.load(Ordering::SeqCst).saturating_sub(1); - let left_thread_name = format!("resampler:{player_id}:left"); - let right_thread_name = format!("resampler:{player_id}:right"); - Resampler::Worker { left_resampler: ResampleWorker::new( MonoSincResampler::new(sample_rate), - left_thread_name, + format!("resampler:{player_id}:left"), ), right_resampler: ResampleWorker::new( MonoSincResampler::new(sample_rate), - right_thread_name, + format!("resampler:{player_id}:right"), ), } }