Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix default dithering behaviour #1283

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ use gethostname::gethostname;
use librespot_core::{
cache::Cache, config::DeviceType as LSDeviceType, config::SessionConfig, version,
};
use librespot_playback::config::{
AudioFormat as LSAudioFormat, Bitrate as LSBitrate, PlayerConfig,
use librespot_playback::{
config::{AudioFormat as LSAudioFormat, Bitrate as LSBitrate, PlayerConfig},
dither::{mk_ditherer, DithererBuilder, TriangularDitherer},
};
use log::{error, info, warn};
use serde::{de::Error, de::Unexpected, Deserialize, Deserializer};
Expand Down Expand Up @@ -829,6 +830,14 @@ pub(crate) fn get_internal_config(config: CliConfig) -> SpotifydConfig {
None => info!("No proxy specified"),
}

// choose default ditherer the same way librespot does
let ditherer: Option<DithererBuilder> = match audio_format {
LSAudioFormat::S16 | LSAudioFormat::S24 | LSAudioFormat::S24_3 => {
Some(mk_ditherer::<TriangularDitherer>)
}
_ => None,
};

// TODO: when we were on librespot 0.1.5, all PlayerConfig values were available in the
// Spotifyd config. The upgrade to librespot 0.2.0 introduces new config variables, and we
// should consider adding them to Spotifyd's config system.
Expand All @@ -837,6 +846,7 @@ pub(crate) fn get_internal_config(config: CliConfig) -> SpotifydConfig {
normalisation: config.shared_config.volume_normalisation,
normalisation_pregain_db: normalisation_pregain,
gapless: true,
ditherer,
..Default::default()
};

Expand Down
Loading