mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Merge pull request #840 from roderickvd/attenuate-last
Attenuate after normalisation
This commit is contained in:
commit
2fcd24164d
1 changed files with 4 additions and 13 deletions
|
@ -1186,10 +1186,6 @@ impl PlayerInternal {
|
||||||
Some(mut packet) => {
|
Some(mut packet) => {
|
||||||
if !packet.is_empty() {
|
if !packet.is_empty() {
|
||||||
if let AudioPacket::Samples(ref mut data) = packet {
|
if let AudioPacket::Samples(ref mut data) = packet {
|
||||||
if let Some(ref editor) = self.audio_filter {
|
|
||||||
editor.modify_stream(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.config.normalisation
|
if self.config.normalisation
|
||||||
&& !(f64::abs(normalisation_factor - 1.0) <= f64::EPSILON
|
&& !(f64::abs(normalisation_factor - 1.0) <= f64::EPSILON
|
||||||
&& self.config.normalisation_method == NormalisationMethod::Basic)
|
&& self.config.normalisation_method == NormalisationMethod::Basic)
|
||||||
|
@ -1290,17 +1286,12 @@ impl PlayerInternal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*sample *= actual_normalisation_factor;
|
*sample *= actual_normalisation_factor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Extremely sharp attacks, however unlikely, *may* still clip and provide
|
if let Some(ref editor) = self.audio_filter {
|
||||||
// undefined results, so strictly enforce output within [-1.0, 1.0].
|
editor.modify_stream(data)
|
||||||
if *sample < -1.0 {
|
|
||||||
*sample = -1.0;
|
|
||||||
} else if *sample > 1.0 {
|
|
||||||
*sample = 1.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue