mirror of
https://github.com/iluvcapra/bwavfile.git
synced 2026-01-02 18:00:44 +00:00
Merge branch 'master' into candidate-v1
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
//! alignment signal.
|
//! alignment signal.
|
||||||
//!
|
//!
|
||||||
//! TODO: Pre-calculate the sine waves to speed up generation
|
//! TODO: Pre-calculate the sine waves to speed up generation
|
||||||
|
//! TODO: Make tone onsets less snappy
|
||||||
|
|
||||||
use std::f64;
|
use std::f64;
|
||||||
use std::io;
|
use std::io;
|
||||||
@@ -34,7 +35,7 @@ fn dbfs_to_f32(dbfs : f32) -> f32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn dbfs_to_signed_int(dbfs: f32, bit_depth: u16) -> i32 {
|
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
|
((full_code as f32) * dbfs_to_f32(dbfs)) as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user