mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
small clean up
This commit is contained in:
parent
1bc16855c9
commit
a331729f0e
2 changed files with 13 additions and 13 deletions
|
@ -180,17 +180,20 @@ impl SampleRate {
|
|||
mut coefficients: Vec<f64>,
|
||||
resample_factor_reciprocal: f64,
|
||||
) -> Vec<f64> {
|
||||
let mut coefficient_sum = 0.0;
|
||||
|
||||
for (index, coefficient) in coefficients.iter_mut().enumerate() {
|
||||
*coefficient *= Self::sinc((index as f64 * resample_factor_reciprocal).fract());
|
||||
|
||||
coefficient_sum += *coefficient;
|
||||
}
|
||||
let mut coefficients_sum = 0.0;
|
||||
|
||||
coefficients
|
||||
.iter_mut()
|
||||
.for_each(|coefficient| *coefficient /= coefficient_sum);
|
||||
.enumerate()
|
||||
.for_each(|(index, coefficient)| {
|
||||
*coefficient *= Self::sinc((index as f64 * resample_factor_reciprocal).fract());
|
||||
|
||||
coefficients_sum += *coefficient;
|
||||
});
|
||||
|
||||
coefficients
|
||||
.iter_mut()
|
||||
.for_each(|coefficient| *coefficient /= coefficients_sum);
|
||||
|
||||
coefficients
|
||||
}
|
||||
|
|
|
@ -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"),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue