From 14d794299da9f2f5f4befd8a474ac26abeb61cc2 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Tue, 28 Jun 2022 05:23:24 +0200 Subject: [PATCH] Fix pverb tests --- tests/common/mod.rs | 13 +++++++++++++ tests/node_pverb.rs | 8 +++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 42b720d..93b9fad 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -357,6 +357,19 @@ pub fn pset_d_wait(matrix: &mut Matrix, ne: &mut NodeExecutor, nid: NodeId, parm run_for_ms(ne, 15.0); } +#[allow(unused)] +pub fn pset_mod(matrix: &mut Matrix, nid: NodeId, parm: &str, modamt: f32) { + let p = nid.inp_param(parm).unwrap(); + matrix.set_param_modamt(p, Some(modamt)); +} + +#[allow(unused)] +pub fn pset_mod_wait(matrix: &mut Matrix, ne: &mut NodeExecutor, nid: NodeId, parm: &str, modamt: f32) { + let p = nid.inp_param(parm).unwrap(); + matrix.set_param_modamt(p, Some(modamt)); + run_for_ms(ne, 15.0); +} + #[allow(dead_code)] pub fn save_wav(name: &str, buf: &[f32]) { let spec = hound::WavSpec { diff --git a/tests/node_pverb.rs b/tests/node_pverb.rs index 94ad8d2..dc3ec91 100644 --- a/tests/node_pverb.rs +++ b/tests/node_pverb.rs @@ -38,6 +38,8 @@ fn setup_pverb(matrix: &mut Matrix) { pset_d(matrix, ad_1, "atk", 6.0); pset_d(matrix, ad_1, "dcy", 100.0); pset_n(matrix, pverb_1, "mix", 1.000); + // quiet down input by 50%, since in_l is doubled in volume effectively: + pset_mod(matrix, pverb_1, "in_l", 0.5); } #[test] @@ -71,9 +73,9 @@ fn check_node_pverb_dcy_1() { //d// for s in &spec { println!("{:?}", s); } // We see the sine decaying with the AD envelope: - assert_eq!(spec[0], vec![(345, 6), (388, 85), (431, 240), (474, 164), (517, 13)]); - assert_eq!(spec[1], vec![(388, 65), (431, 185), (474, 126), (517, 10)]); - assert_eq!(spec[2], vec![(345, 11), (388, 24), (431, 32), (474, 29), (517, 16), (560, 6)]); + assert_eq!(spec[0], vec![(388, 42), (431, 120), (474, 82), (517, 6)]); + assert_eq!(spec[1], vec![(388, 32), (431, 92), (474, 63), (517, 5)]); + assert_eq!(spec[2], vec![(345, 5), (388, 12), (431, 16), (474, 14), (517, 8)]); assert_eq!(spec[3], vec![]); // Wet mix & clear out the reset in the tank: