fixed slew times of the rndwk tests

This commit is contained in:
Weird Constructor 2021-08-13 06:12:18 +02:00
parent 993c690bc4
commit d2cd29c65f

View file

@ -24,23 +24,22 @@ fn check_node_rndwk_def_trig() {
let (out_l, _) = run_for_ms(&mut node_exec, 20.0);
assert_decimated_feq!(out_l, 40, vec![
0.0, // start value
// 10ms ramp:
0.0049022376, 0.015222744, 0.025543215, 0.035863716, 0.04618426,
0.056504805, 0.066825345, 0.07714589, 0.08746643, 0.09778698,
0.10810752,
// slew ramp:
0.00574452, 0.017838247, 0.029931974, 0.0420257, 0.054119427,
0.06621315, 0.078306876, 0.09040061, 0.10249433,
// end value:
0.11378352, 0.11378352, 0.11378352, 0.11378352, 0.11378352,
]);
pset_n(&mut matrix, rwk, "trig", 0.0);
pset_d_wait(&mut matrix, &mut node_exec, rwk, "slewt", 1.0);
pset_d_wait(&mut matrix, &mut node_exec, rwk, "slew", 10.0);
pset_n(&mut matrix, rwk, "trig", 1.0);
run_for_ms(&mut node_exec, 7.0); // wait for trigger...
let (out_l, _) = run_for_ms(&mut node_exec, 20.0);
assert_decimated_feq!(out_l, 15, vec![
0.11378352, 0.11378352, // last value
0.1436584, 0.19344981, 0.24324122, // 1ms ramp 15 * 3 => ~44.1 samples
0.13419169, 0.16820529, 0.20221889, 0.2362325,
0.26017055, 0.26017055, // end value
]);
}
@ -62,12 +61,12 @@ fn check_node_rndwk_step() {
pset_n(&mut matrix, rwk, "trig", 1.0);
run_for_ms(&mut node_exec, 7.0); // wait for trigger...
let (out_l, _) = run_for_ms(&mut node_exec, 20.0);
assert_decimated_feq!(out_l, 60, vec![
let (out_l, _) = run_for_ms(&mut node_exec, 50.0);
assert_decimated_feq!(out_l, 200, vec![
0.0, // start value
// 10ms ramp:
0.050312463, 0.12771615, 0.20512024, 0.28252393, 0.35992712,
0.4373303, 0.51473385,
// slew ramp:
0.054119427, 0.11458806, 0.1750567, 0.23552532, 0.29599395,
0.3564626, 0.4169312, 0.47739986, 0.5378685,
// end value
// which is 5.0 * 0.11378352
// (the first random sample, see previous test)
@ -87,6 +86,7 @@ fn check_node_rndwk_offs() {
matrix.place(0, 1, Cell::empty(out)
.input(out.inp("ch1"), None, None));
pset_d(&mut matrix, rwk, "offs", 0.3);
pset_d(&mut matrix, rwk, "slew", 10.0);
matrix.sync().unwrap();
pset_n(&mut matrix, rwk, "trig", 1.0);
@ -95,9 +95,8 @@ fn check_node_rndwk_offs() {
let (out_l, _) = run_for_ms(&mut node_exec, 20.0);
assert_decimated_feq!(out_l, 60, vec![
0.0, // start value
// 10ms ramp:
0.03659311, 0.0928901, 0.14918698, 0.20548387,
0.26178095, 0.31807873, 0.3743765,
// slew ramp:
0.088435374, 0.2244898, 0.3605442,
// end value
// which is 0.11378352 + 0.3
// (the first random sample, see previous test)
@ -127,9 +126,8 @@ fn check_node_rndwk_offs_neg() {
let (out_l, _) = run_for_ms(&mut node_exec, 20.0);
assert_decimated_feq!(out_l, 60, vec![
0.0, // start value
// 10ms ramp:
0.007624589, 0.019354708, 0.03108479, 0.042814985, 0.05454518,
0.06627537, 0.07800557,
// slew ramp:
0.011791383, 0.029931974, 0.04807256, 0.06621315, 0.084353745,
// end value
// which is (0.11378352 - 0.2).abs()
0.08621648, 0.08621648,
@ -157,9 +155,8 @@ fn check_node_rndwk_max() {
let (out_l, _) = run_for_ms(&mut node_exec, 20.0);
assert_decimated_feq!(out_l, 60, vec![
0.0, // start value
// 10ms ramp:
0.006094757, 0.015471312, 0.024847867, 0.03422442, 0.043600976,
0.052977532, 0.062354088,
// slew ramp:
0.011791383, 0.029931974, 0.04807256, 0.06621315,
// end value
// which is 0.5 - 0.56891763
0.06891763, 0.06891763,
@ -185,12 +182,12 @@ fn check_node_rndwk_min() {
pset_n(&mut matrix, rwk, "trig", 1.0);
run_for_ms(&mut node_exec, 7.0); // wait for trigger...
let (out_l, _) = run_for_ms(&mut node_exec, 20.0);
assert_decimated_feq!(out_l, 60, vec![
let (out_l, _) = run_for_ms(&mut node_exec, 100.0); // 75ms slew time default
assert_decimated_feq!(out_l, 400, vec![
0.0, // start value
// 10ms ramp:
0.08234063, 0.20901868, 0.33569613, 0.4623733, 0.5890517,
0.71573067, 0.8424096,
// slew ramp:
0.11458806, 0.23552532, 0.3564626, 0.47739986,
0.5983371, 0.7192744, 0.84021163,
// end value
0.93108237, 0.93108237, 0.93108237, 0.93108237, 0.93108237, 0.93108237,
]);