Fixed bug in decibels code, was too loud

This commit is contained in:
Jamie Hardt
2021-01-02 18:09:39 -08:00
parent 5057862258
commit 190e8bc677

View File

@@ -34,7 +34,7 @@ fn dbfs_to_f32(dbfs : f32) -> f32 {
}
fn dbfs_to_signed_int(dbfs: f32, bit_depth: u16) -> i32 {
let full_code : i32 = (1i32 << (bit_depth + 1)) - 1;
let full_code : i32 = (1i32 << bit_depth - 1) - 1;
((full_code as f32) * dbfs_to_f32(dbfs)) as i32
}