Fix pverb tests

This commit is contained in:
Weird Constructor 2022-06-28 05:23:24 +02:00
parent 355a133d67
commit 14d794299d
2 changed files with 18 additions and 3 deletions

View file

@ -357,6 +357,19 @@ pub fn pset_d_wait(matrix: &mut Matrix, ne: &mut NodeExecutor, nid: NodeId, parm
run_for_ms(ne, 15.0); 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)] #[allow(dead_code)]
pub fn save_wav(name: &str, buf: &[f32]) { pub fn save_wav(name: &str, buf: &[f32]) {
let spec = hound::WavSpec { let spec = hound::WavSpec {

View file

@ -38,6 +38,8 @@ fn setup_pverb(matrix: &mut Matrix) {
pset_d(matrix, ad_1, "atk", 6.0); pset_d(matrix, ad_1, "atk", 6.0);
pset_d(matrix, ad_1, "dcy", 100.0); pset_d(matrix, ad_1, "dcy", 100.0);
pset_n(matrix, pverb_1, "mix", 1.000); 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] #[test]
@ -71,9 +73,9 @@ fn check_node_pverb_dcy_1() {
//d// for s in &spec { println!("{:?}", s); } //d// for s in &spec { println!("{:?}", s); }
// We see the sine decaying with the AD envelope: // 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[0], vec![(388, 42), (431, 120), (474, 82), (517, 6)]);
assert_eq!(spec[1], vec![(388, 65), (431, 185), (474, 126), (517, 10)]); assert_eq!(spec[1], vec![(388, 32), (431, 92), (474, 63), (517, 5)]);
assert_eq!(spec[2], vec![(345, 11), (388, 24), (431, 32), (474, 29), (517, 16), (560, 6)]); assert_eq!(spec[2], vec![(345, 5), (388, 12), (431, 16), (474, 14), (517, 8)]);
assert_eq!(spec[3], vec![]); assert_eq!(spec[3], vec![]);
// Wet mix & clear out the reset in the tank: // Wet mix & clear out the reset in the tank: