implement volume normalization setting

fixes #195
This commit is contained in:
Henrik Friedrichsen
2020-05-14 21:48:09 +02:00
parent 2e89cc3d01
commit 85bc898830
3 changed files with 6 additions and 2 deletions

View File

@@ -122,6 +122,8 @@ values are:
* `use_nerdfont`: Turn nerdfont glyphs on/off <true/false>
* `theme`: Set a custom color palette (see below)
* `volnorm`: Enable or disable volume normalization, off by default <true/false>
* `volnorm_pregain`: Normalization pregain to apply (if enabled)
Keybindings can be configured in `[keybindings]` section in `config.toml`, e.g. as such:

View File

@@ -13,6 +13,8 @@ pub struct Config {
pub theme: Option<ConfigTheme>,
pub use_nerdfont: Option<bool>,
pub saved_state: Option<SavedState>,
pub volnorm: Option<bool>,
pub volnorm_pregain: Option<f32>,
}
#[derive(Serialize, Deserialize, Debug, Default, Clone)]

View File

@@ -225,8 +225,8 @@ impl Spotify {
pub fn new(events: EventManager, credentials: Credentials, cfg: &config::Config) -> Spotify {
let player_config = PlayerConfig {
bitrate: Bitrate::Bitrate320,
normalisation: false,
normalisation_pregain: 0.0,
normalisation: cfg.volnorm.unwrap_or(false),
normalisation_pregain: cfg.volnorm_pregain.unwrap_or(0.0),
};
let (user_tx, user_rx) = oneshot::channel();
let volume = match &cfg.saved_state {