fixed sine detune test

This commit is contained in:
Weird Constructor 2021-06-06 09:31:41 +02:00
parent a9ac28e351
commit 1ceb25bf31
2 changed files with 16 additions and 7 deletions

View file

@ -249,11 +249,10 @@ macro_rules! d_pit { ($x: expr) => {
}
} }
// 5.0 for mapping -0.2-0.2 range to -1.0 to 1.0
// 5.0 * 0.2 => 24.0
// 5.0 * 0.1 => 12.0
// 5.0 * 0.008333333 => 1.0
// 5.0 * 0.000083333 => 0.001
// 0.2 => 24.0
// 0.1 => 12.0
// 0.008333333 => 1.0
// 0.000083333 => 0.001
macro_rules! n_det { ($x: expr) => { $x / 120.0 } }
macro_rules! d_det { ($x: expr) => { $x * 120.0 } }

View file

@ -186,8 +186,18 @@ fn check_sine_freq_detune() {
matrix.set_param(det_param, SAtom::param(det_param.norm(1.0)));
run_no_input(&mut node_exec, 50.0);
let cfreq = run_and_get_counted_freq(&mut node_exec, 1000.0);
assert_float_eq!(cfreq.floor(), 493.0);
let cfreq = run_and_get_counted_freq(&mut node_exec, 250.0);
assert_float_eq!(cfreq.floor(), 466.0);
matrix.set_param(det_param, SAtom::param(det_param.norm(-1.0)));
run_no_input(&mut node_exec, 50.0);
let cfreq = run_and_get_counted_freq(&mut node_exec, 300.0);
assert_float_eq!(cfreq.floor(), 415.0);
matrix.set_param(det_param, SAtom::param(det_param.norm(-14.0)));
run_no_input(&mut node_exec, 50.0);
let cfreq = run_and_get_counted_freq(&mut node_exec, 400.0);
assert_float_eq!(cfreq.floor(), 196.0);
}
#[test]