Remove getNoteGain

This commit is contained in:
Paul Fd 2020-03-26 00:30:17 +01:00 committed by Paul Ferrand
parent 78851082ea
commit 1e2a18359e

View file

@ -21,9 +21,9 @@ TEST_CASE("[Region] Crossfade in on key")
region.parseOpcode({ "sample", "*sine" });
region.parseOpcode({ "xfin_lokey", "1" });
region.parseOpcode({ "xfin_hikey", "3" });
REQUIRE( region.getNoteGain(2, 127) == 0.70711_a );
REQUIRE( region.getNoteGain(1, 127) == 0.0_a );
REQUIRE( region.getNoteGain(3, 127) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(2, 127_norm) == 0.70711_a );
REQUIRE( region.getNoteGainNormalized(1, 127_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(3, 127_norm) == 1.0_a );
}
TEST_CASE("[Region] Crossfade in on key - 2")
@ -33,12 +33,12 @@ TEST_CASE("[Region] Crossfade in on key - 2")
region.parseOpcode({ "sample", "*sine" });
region.parseOpcode({ "xfin_lokey", "1" });
region.parseOpcode({ "xfin_hikey", "5" });
REQUIRE( region.getNoteGain(1, 127) == 0.0_a );
REQUIRE( region.getNoteGain(2, 127) == 0.5_a );
REQUIRE( region.getNoteGain(3, 127) == 0.70711_a );
REQUIRE( region.getNoteGain(4, 127) == 0.86603_a );
REQUIRE( region.getNoteGain(5, 127) == 1.0_a );
REQUIRE( region.getNoteGain(6, 127) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(1, 127_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(2, 127_norm) == 0.5_a );
REQUIRE( region.getNoteGainNormalized(3, 127_norm) == 0.70711_a );
REQUIRE( region.getNoteGainNormalized(4, 127_norm) == 0.86603_a );
REQUIRE( region.getNoteGainNormalized(5, 127_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(6, 127_norm) == 1.0_a );
}
TEST_CASE("[Region] Crossfade in on key - gain")
@ -49,11 +49,11 @@ TEST_CASE("[Region] Crossfade in on key - gain")
region.parseOpcode({ "xfin_lokey", "1" });
region.parseOpcode({ "xfin_hikey", "5" });
region.parseOpcode({ "xf_keycurve", "gain" });
REQUIRE( region.getNoteGain(1, 127) == 0.0_a );
REQUIRE( region.getNoteGain(2, 127) == 0.25_a );
REQUIRE( region.getNoteGain(3, 127) == 0.5_a );
REQUIRE( region.getNoteGain(4, 127) == 0.75_a );
REQUIRE( region.getNoteGain(5, 127) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(1, 127_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(2, 127_norm) == 0.25_a );
REQUIRE( region.getNoteGainNormalized(3, 127_norm) == 0.5_a );
REQUIRE( region.getNoteGainNormalized(4, 127_norm) == 0.75_a );
REQUIRE( region.getNoteGainNormalized(5, 127_norm) == 1.0_a );
}
TEST_CASE("[Region] Crossfade out on key")
@ -63,13 +63,13 @@ TEST_CASE("[Region] Crossfade out on key")
region.parseOpcode({ "sample", "*sine" });
region.parseOpcode({ "xfout_lokey", "51" });
region.parseOpcode({ "xfout_hikey", "55" });
REQUIRE( region.getNoteGain(50, 127) == 1.0_a );
REQUIRE( region.getNoteGain(51, 127) == 1.0_a );
REQUIRE( region.getNoteGain(52, 127) == 0.86603_a );
REQUIRE( region.getNoteGain(53, 127) == 0.70711_a );
REQUIRE( region.getNoteGain(54, 127) == 0.5_a );
REQUIRE( region.getNoteGain(55, 127) == 0.0_a );
REQUIRE( region.getNoteGain(56, 127) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(50, 127_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(51, 127_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(52, 127_norm) == 0.86603_a );
REQUIRE( region.getNoteGainNormalized(53, 127_norm) == 0.70711_a );
REQUIRE( region.getNoteGainNormalized(54, 127_norm) == 0.5_a );
REQUIRE( region.getNoteGainNormalized(55, 127_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(56, 127_norm) == 0.0_a );
}
TEST_CASE("[Region] Crossfade out on key - gain")
@ -80,13 +80,13 @@ TEST_CASE("[Region] Crossfade out on key - gain")
region.parseOpcode({ "xfout_lokey", "51" });
region.parseOpcode({ "xfout_hikey", "55" });
region.parseOpcode({ "xf_keycurve", "gain" });
REQUIRE( region.getNoteGain(50, 127) == 1.0_a );
REQUIRE( region.getNoteGain(51, 127) == 1.0_a );
REQUIRE( region.getNoteGain(52, 127) == 0.75_a );
REQUIRE( region.getNoteGain(53, 127) == 0.5_a );
REQUIRE( region.getNoteGain(54, 127) == 0.25_a );
REQUIRE( region.getNoteGain(55, 127) == 0.0_a );
REQUIRE( region.getNoteGain(56, 127) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(50, 127_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(51, 127_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(52, 127_norm) == 0.75_a );
REQUIRE( region.getNoteGainNormalized(53, 127_norm) == 0.5_a );
REQUIRE( region.getNoteGainNormalized(54, 127_norm) == 0.25_a );
REQUIRE( region.getNoteGainNormalized(55, 127_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(56, 127_norm) == 0.0_a );
}
TEST_CASE("[Region] Crossfade in on velocity")
@ -97,13 +97,13 @@ TEST_CASE("[Region] Crossfade in on velocity")
region.parseOpcode({ "xfin_lovel", "20" });
region.parseOpcode({ "xfin_hivel", "24" });
region.parseOpcode({ "amp_veltrack", "0" });
REQUIRE( region.getNoteGain(1, 19) == 0.0_a );
REQUIRE( region.getNoteGain(1, 20) == 0.0_a );
REQUIRE( region.getNoteGain(2, 21) == 0.5_a );
REQUIRE( region.getNoteGain(3, 22) == 0.70711_a );
REQUIRE( region.getNoteGain(4, 23) == 0.86603_a );
REQUIRE( region.getNoteGain(5, 24) == 1.0_a );
REQUIRE( region.getNoteGain(6, 25) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(1, 19_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(1, 20_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(2, 21_norm) == 0.5_a );
REQUIRE( region.getNoteGainNormalized(3, 22_norm) == 0.70711_a );
REQUIRE( region.getNoteGainNormalized(4, 23_norm) == 0.86603_a );
REQUIRE( region.getNoteGainNormalized(5, 24_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(6, 25_norm) == 1.0_a );
}
TEST_CASE("[Region] Crossfade in on vel - gain")
@ -115,13 +115,13 @@ TEST_CASE("[Region] Crossfade in on vel - gain")
region.parseOpcode({ "xfin_hivel", "24" });
region.parseOpcode({ "xf_velcurve", "gain" });
region.parseOpcode({ "amp_veltrack", "0" });
REQUIRE( region.getNoteGain(1, 19) == 0.0_a );
REQUIRE( region.getNoteGain(1, 20) == 0.0_a );
REQUIRE( region.getNoteGain(2, 21) == 0.25_a );
REQUIRE( region.getNoteGain(3, 22) == 0.5_a );
REQUIRE( region.getNoteGain(4, 23) == 0.75_a );
REQUIRE( region.getNoteGain(5, 24) == 1.0_a );
REQUIRE( region.getNoteGain(5, 25) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(1, 19_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(1, 20_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(2, 21_norm) == 0.25_a );
REQUIRE( region.getNoteGainNormalized(3, 22_norm) == 0.5_a );
REQUIRE( region.getNoteGainNormalized(4, 23_norm) == 0.75_a );
REQUIRE( region.getNoteGainNormalized(5, 24_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(5, 25_norm) == 1.0_a );
}
TEST_CASE("[Region] Crossfade out on vel")
@ -132,13 +132,13 @@ TEST_CASE("[Region] Crossfade out on vel")
region.parseOpcode({ "xfout_lovel", "51" });
region.parseOpcode({ "xfout_hivel", "55" });
region.parseOpcode({ "amp_veltrack", "0" });
REQUIRE( region.getNoteGain(5, 50) == 1.0_a );
REQUIRE( region.getNoteGain(5, 51) == 1.0_a );
REQUIRE( region.getNoteGain(5, 52) == 0.86603_a );
REQUIRE( region.getNoteGain(5, 53) == 0.70711_a );
REQUIRE( region.getNoteGain(5, 54) == 0.5_a );
REQUIRE( region.getNoteGain(5, 55) == 0.0_a );
REQUIRE( region.getNoteGain(5, 56) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(5, 50_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(5, 51_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(5, 52_norm) == 0.86603_a );
REQUIRE( region.getNoteGainNormalized(5, 53_norm) == 0.70711_a );
REQUIRE( region.getNoteGainNormalized(5, 54_norm) == 0.5_a );
REQUIRE( region.getNoteGainNormalized(5, 55_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(5, 56_norm) == 0.0_a );
}
TEST_CASE("[Region] Crossfade out on vel - gain")
@ -150,13 +150,13 @@ TEST_CASE("[Region] Crossfade out on vel - gain")
region.parseOpcode({ "xfout_hivel", "55" });
region.parseOpcode({ "xf_velcurve", "gain" });
region.parseOpcode({ "amp_veltrack", "0" });
REQUIRE( region.getNoteGain(56, 50) == 1.0_a );
REQUIRE( region.getNoteGain(56, 51) == 1.0_a );
REQUIRE( region.getNoteGain(56, 52) == 0.75_a );
REQUIRE( region.getNoteGain(56, 53) == 0.5_a );
REQUIRE( region.getNoteGain(56, 54) == 0.25_a );
REQUIRE( region.getNoteGain(56, 55) == 0.0_a );
REQUIRE( region.getNoteGain(56, 56) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(56, 50_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(56, 51_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(56, 52_norm) == 0.75_a );
REQUIRE( region.getNoteGainNormalized(56, 53_norm) == 0.5_a );
REQUIRE( region.getNoteGainNormalized(56, 54_norm) == 0.25_a );
REQUIRE( region.getNoteGainNormalized(56, 55_norm) == 0.0_a );
REQUIRE( region.getNoteGainNormalized(56, 56_norm) == 0.0_a );
}
TEST_CASE("[Region] Crossfade in on CC")
@ -234,8 +234,8 @@ TEST_CASE("[Region] Velocity bug for extreme values - veltrack at 0")
sfz::Region region { midiState };
region.parseOpcode({ "sample", "*sine" });
region.parseOpcode({ "amp_veltrack", "0" });
REQUIRE( region.getNoteGain(64, 127) == 1.0_a );
REQUIRE( region.getNoteGain(64, 0) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(64, 127_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(64, 0_norm) == 1.0_a );
}
@ -245,8 +245,8 @@ TEST_CASE("[Region] Velocity bug for extreme values - positive veltrack")
sfz::Region region { midiState };
region.parseOpcode({ "sample", "*sine" });
region.parseOpcode({ "amp_veltrack", "100" });
REQUIRE( region.getNoteGain(64, 127) == 1.0_a );
REQUIRE( region.getNoteGain(64, 0) == Approx(0.0).margin(0.0001) );
REQUIRE( region.getNoteGainNormalized(64, 127_norm) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(64, 0_norm) == Approx(0.0).margin(0.0001) );
}
TEST_CASE("[Region] Velocity bug for extreme values - negative veltrack")
@ -255,8 +255,8 @@ TEST_CASE("[Region] Velocity bug for extreme values - negative veltrack")
sfz::Region region { midiState };
region.parseOpcode({ "sample", "*sine" });
region.parseOpcode({ "amp_veltrack", "-100" });
REQUIRE( region.getNoteGain(64, 127) == Approx(0.0).margin(0.0001) );
REQUIRE( region.getNoteGain(64, 0) == 1.0_a );
REQUIRE( region.getNoteGainNormalized(64, 127_norm) == Approx(0.0).margin(0.0001) );
REQUIRE( region.getNoteGainNormalized(64, 0_norm) == 1.0_a );
}
TEST_CASE("[Region] rt_decay")