fix(vst): master-gain per-sample ramp (no zipper/click); voice-count commits once on release; minor review items

This commit is contained in:
2026-07-27 23:30:27 -04:00
parent 43155cf320
commit e2c73e30d6
7 changed files with 116 additions and 43 deletions
+16
View File
@@ -74,6 +74,21 @@ static void testNonFiniteLinearClamps() {
CHECK(near(masterGainNormFromLinear(1e9), 1.0)); // above the cap clamps to 1
}
static void testBelowFloorCollapsesToBottom() {
// Any linear gain at or below the kMasterGainMinDb floor collapses to norm 0 (the -inf
// bottom detent). The floor IS the bottom of the finite sweep, so -61 dB, -80 dB, and
// a vanishingly small positive linear all map to the same place as true zero.
const double floorLinear = std::pow(10.0, kMasterGainMinDb / 20.0); // 10^(-60/20) = 0.001
CHECK(masterGainNormFromLinear(floorLinear) == 0.0); // exactly at the floor -> bottom
CHECK(masterGainNormFromLinear(floorLinear * 0.5) == 0.0); // below the floor -> bottom
CHECK(masterGainNormFromLinear(1e-9) == 0.0); // tiny positive -> bottom
// The dB path agrees: anything at or below kMasterGainMinDb maps to norm 0.
CHECK(masterGainNormFromDb(kMasterGainMinDb) == 0.0);
CHECK(masterGainNormFromDb(kMasterGainMinDb - 20.0) == 0.0); // -80 dB -> bottom
// Just ABOVE the floor (by epsilon) returns a non-zero norm.
CHECK(masterGainNormFromDb(kMasterGainMinDb + 1e-9) > 0.0);
}
static void testLabels() {
char buf[24];
formatMasterGainLabel(0.0, buf, sizeof(buf));
@@ -93,6 +108,7 @@ int main() {
testNormLinearRoundTripAcrossTravel();
testMonotonic();
testNonFiniteLinearClamps();
testBelowFloorCollapsesToBottom();
testLabels();
if (g_fail) {
std::printf("%d FAILURE(S)\n", g_fail);