mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Fix default normalisation threshold [#745]
This commit is contained in:
parent
041f084d7f
commit
a4ad6d4aa8
3 changed files with 21 additions and 15 deletions
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
* [librespot-audio] Removed `VorbisDecoder`, `VorbisError`, `AudioPacket`, `PassthroughDecoder`, `PassthroughError`, `AudioError`, `AudioDecoder` and the `convert` module from `librespot_audio`. The underlying crates `vorbis`, `librespot-tremor`, `lewton` and `ogg` should be used directly.
|
* [librespot-audio] Removed `VorbisDecoder`, `VorbisError`, `AudioPacket`, `PassthroughDecoder`, `PassthroughError`, `AudioError`, `AudioDecoder` and the `convert` module from `librespot_audio`. The underlying crates `vorbis`, `librespot-tremor`, `lewton` and `ogg` should be used directly.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* [librespot-playback] Incorrect `PlayerConfig::default().normalisation_threshold` caused distortion when using dynamic volume normalisation downstream
|
||||||
|
|
||||||
## [0.2.0] - 2021-05-04
|
## [0.2.0] - 2021-05-04
|
||||||
|
|
||||||
## [0.1.6] - 2021-02-22
|
## [0.1.6] - 2021-02-22
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
use super::player::NormalisationData;
|
||||||
use crate::convert::i24;
|
use crate::convert::i24;
|
||||||
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
@ -138,7 +140,7 @@ impl Default for PlayerConfig {
|
||||||
normalisation_type: NormalisationType::default(),
|
normalisation_type: NormalisationType::default(),
|
||||||
normalisation_method: NormalisationMethod::default(),
|
normalisation_method: NormalisationMethod::default(),
|
||||||
normalisation_pregain: 0.0,
|
normalisation_pregain: 0.0,
|
||||||
normalisation_threshold: -1.0,
|
normalisation_threshold: NormalisationData::db_to_ratio(-1.0),
|
||||||
normalisation_attack: 0.005,
|
normalisation_attack: 0.005,
|
||||||
normalisation_release: 0.1,
|
normalisation_release: 0.1,
|
||||||
normalisation_knee: 1.0,
|
normalisation_knee: 1.0,
|
||||||
|
|
20
src/main.rs
20
src/main.rs
|
@ -557,26 +557,26 @@ fn get_setup(args: &[String]) -> Setup {
|
||||||
.opt_str("normalisation-pregain")
|
.opt_str("normalisation-pregain")
|
||||||
.map(|pregain| pregain.parse::<f32>().expect("Invalid pregain float value"))
|
.map(|pregain| pregain.parse::<f32>().expect("Invalid pregain float value"))
|
||||||
.unwrap_or(PlayerConfig::default().normalisation_pregain),
|
.unwrap_or(PlayerConfig::default().normalisation_pregain),
|
||||||
normalisation_threshold: NormalisationData::db_to_ratio(
|
normalisation_threshold: matches
|
||||||
matches
|
|
||||||
.opt_str("normalisation-threshold")
|
.opt_str("normalisation-threshold")
|
||||||
.map(|threshold| {
|
.map(|threshold| {
|
||||||
|
NormalisationData::db_to_ratio(
|
||||||
threshold
|
threshold
|
||||||
.parse::<f32>()
|
.parse::<f32>()
|
||||||
.expect("Invalid threshold float value")
|
.expect("Invalid threshold float value"),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.unwrap_or(PlayerConfig::default().normalisation_threshold),
|
.unwrap_or(PlayerConfig::default().normalisation_threshold),
|
||||||
),
|
|
||||||
normalisation_attack: matches
|
normalisation_attack: matches
|
||||||
.opt_str("normalisation-attack")
|
.opt_str("normalisation-attack")
|
||||||
.map(|attack| attack.parse::<f32>().expect("Invalid attack float value"))
|
.map(|attack| attack.parse::<f32>().expect("Invalid attack float value") / MILLIS)
|
||||||
.unwrap_or(PlayerConfig::default().normalisation_attack * MILLIS)
|
.unwrap_or(PlayerConfig::default().normalisation_attack),
|
||||||
/ MILLIS,
|
|
||||||
normalisation_release: matches
|
normalisation_release: matches
|
||||||
.opt_str("normalisation-release")
|
.opt_str("normalisation-release")
|
||||||
.map(|release| release.parse::<f32>().expect("Invalid release float value"))
|
.map(|release| {
|
||||||
.unwrap_or(PlayerConfig::default().normalisation_release * MILLIS)
|
release.parse::<f32>().expect("Invalid release float value") / MILLIS
|
||||||
/ MILLIS,
|
})
|
||||||
|
.unwrap_or(PlayerConfig::default().normalisation_release),
|
||||||
normalisation_knee: matches
|
normalisation_knee: matches
|
||||||
.opt_str("normalisation-knee")
|
.opt_str("normalisation-knee")
|
||||||
.map(|knee| knee.parse::<f32>().expect("Invalid knee float value"))
|
.map(|knee| knee.parse::<f32>().expect("Invalid knee float value"))
|
||||||
|
|
Loading…
Reference in a new issue