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

Volume normalization #114

Closed

Conversation

herrernst
Copy link
Contributor

See #15

@ComlOnline
Copy link
Contributor

ComlOnline commented Jan 31, 2018

@herrernst Your conflict in main is due to the zeroconf-port option addition.
And in player its due to all the commits since we forked from plietar.
You can see a list here:
https://github.com/librespot-org/librespot/commits/master/src/player.rs

@herrernst
Copy link
Contributor Author

@ComlOnline Feel free to resolve them ;)

@ComlOnline
Copy link
Contributor

ComlOnline commented Jan 31, 2018

I will do but it will take some time as github wont let me do it online.

And just as I comment that I now can. Doing it now.

@ComlOnline
Copy link
Contributor

That should have done it, compiling now to check.

@herrernst herrernst force-pushed the volume-normalization branch from d309ddd to 67765f7 Compare February 1, 2018 19:09
@@ -105,6 +105,8 @@ pub struct PlayerConfig {
pub bitrate: Bitrate,
pub onstart: Option<String>,
pub onstop: Option<String>,
pub normalization: bool,
pub normalization_pre_gain: f32,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use pregain as a single word, here and elsewhere.


if normalization_factor != 1.0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine these two ifs

let mut track_gain_float_bytes = [0; 4];

decrypted_file.seek(SeekFrom::Start(144)).unwrap(); // 4 bytes as LE float
decrypted_file.read(&mut track_gain_float_bytes).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use read_f32::<LittleEndian>

let mut normalization_factor: f32 = 1.0;

if self.config.normalization {
//buffer for float bytes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break this up into a function which does the parsing and returns a struct with 4 f32s. You can #[derive(Debug)] and use a single debug statement.

ashthespy added a commit to ashthespy/librespot that referenced this pull request Feb 6, 2018
@sashahilton00
Copy link
Member

@herrernst pinging in case forgotten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants