mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
More warnings
This commit is contained in:
parent
841f923549
commit
20414e44b8
2 changed files with 25 additions and 12 deletions
|
@ -74,6 +74,11 @@ impl InterpolationQuality {
|
|||
|
||||
let mut coefficients = Vec::with_capacity(interpolation_coefficients_length);
|
||||
|
||||
if interpolation_coefficients_length == 0 {
|
||||
warn!("InterpolationQuality::Low::get_interpolation_coefficients always returns an empty Vec<f64> because Linear Interpolation does not use coefficients");
|
||||
return coefficients;
|
||||
}
|
||||
|
||||
let last_index = interpolation_coefficients_length as f64 - 1.0;
|
||||
|
||||
let sinc_center = last_index * 0.5;
|
||||
|
@ -201,11 +206,27 @@ impl SampleRate {
|
|||
}
|
||||
|
||||
pub fn duration_to_normalisation_coefficient(&self, duration: Duration) -> f64 {
|
||||
(-1.0 / (duration.as_secs_f64() * self.samples_per_second())).exp()
|
||||
let secs = duration.as_secs_f64();
|
||||
let ms = secs * 1000.0;
|
||||
|
||||
if ms < 1.0 {
|
||||
warn!("Coefficient Duration: {:.0} ms, a Normalisation Attack/Release of < 1 ms will cause severe distortion", ms);
|
||||
}
|
||||
|
||||
(-1.0 / (secs * self.samples_per_second())).exp()
|
||||
}
|
||||
|
||||
pub fn normalisation_coefficient_to_duration(&self, coefficient: f64) -> Duration {
|
||||
Duration::from_secs_f64(-1.0 / coefficient.ln() / self.samples_per_second())
|
||||
let duration = Duration::from_secs_f64(-1.0 / coefficient.ln() / self.samples_per_second());
|
||||
|
||||
let secs = duration.as_secs_f64();
|
||||
let ms = secs * 1000.0;
|
||||
|
||||
if ms < 1.0 {
|
||||
warn!("Coefficient Duration: {:.0} ms, a Normalisation Attack/Release of < 1 ms will cause severe distortion", ms);
|
||||
}
|
||||
|
||||
duration
|
||||
}
|
||||
|
||||
fn samples_per_second(&self) -> f64 {
|
||||
|
|
|
@ -52,11 +52,7 @@ impl DynamicNormalisation {
|
|||
.as_secs_f64()
|
||||
* 1000.0;
|
||||
|
||||
if attack < 1.0 {
|
||||
warn!("Normalisation Attack: {:.0} ms, an Attack of < 1.0 ms will cause severe distortion", attack);
|
||||
} else {
|
||||
debug!("Normalisation Attack: {:.0} ms", attack);
|
||||
}
|
||||
debug!("Normalisation Attack: {:.0} ms", attack);
|
||||
|
||||
let release = config
|
||||
.sample_rate
|
||||
|
@ -64,11 +60,7 @@ impl DynamicNormalisation {
|
|||
.as_secs_f64()
|
||||
* 1000.0;
|
||||
|
||||
if release < 1.0 {
|
||||
warn!("Normalisation Release: {:.0} ms, a Release of < 1.0 ms will cause severe distortion", release);
|
||||
} else {
|
||||
debug!("Normalisation Release: {:.0} ms", release);
|
||||
}
|
||||
debug!("Normalisation Release: {:.0} ms", release);
|
||||
|
||||
Self {
|
||||
threshold_db: config.normalisation_threshold_dbfs,
|
||||
|
|
Loading…
Reference in a new issue