Skip to content

Commit

Permalink
Backport librespot-org#1159: don't normalize value when we're using f…
Browse files Browse the repository at this point in the history
…ixed volume.
  • Loading branch information
michaelherger committed May 4, 2023
1 parent 71e54d4 commit 931b4e6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions playback/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1323,9 +1323,11 @@ impl PlayerInternal {
// there is nothing to normalise (all samples should pass unaltered). For the
// dynamic method, there may still be peaks that we want to shave off.
// No matter the case we apply volume attenuation last if there is any.
if !self.config.normalisation && volume < 1.0 {
for sample in data.iter_mut() {
*sample *= volume;
if !self.config.normalisation {
if volume < 1.0 {
for sample in data.iter_mut() {
*sample *= volume;
}
}
} else if self.config.normalisation_method == NormalisationMethod::Basic
&& (normalisation_factor < 1.0 || volume < 1.0)
Expand Down

0 comments on commit 931b4e6

Please sign in to comment.