-
Notifications
You must be signed in to change notification settings - Fork 645
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
Volume normalization #114
Conversation
@herrernst Your conflict in main is due to the zeroconf-port option addition. |
@ComlOnline Feel free to resolve them ;) |
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. |
That should have done it, compiling now to check. |
d309ddd
to
67765f7
Compare
@@ -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, |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
@herrernst pinging in case forgotten. |
See #15