Gamma-W1-T7: gate PSOLA's two untested wires, fix the cadence test's contradictory rationale, add a vacuity guard

This commit is contained in:
2026-08-02 03:01:15 -04:00
parent 93230208ff
commit 334022c0f1
5 changed files with 64 additions and 9 deletions
+20
View File
@@ -2991,6 +2991,25 @@ static void testPreserveUnityRateIsBitIdenticalToTheShippedRead() {
}
}
// --- The load->voice wire is load-bearing: Voice::start (voice.cpp:248-249) is the only place
// a detected period reaches the shifter. Assert the two SampleDatas actually render
// differently rather than only that setSourcePeriod is callable — dropping either of the
// wire's two lines left this whole gated suite green before this test existed.
static void testSourcePeriodChangesTheRenderedStream() {
const std::int64_t w = 2205; // the product window at 44.1k
const std::size_t n = 6000;
SampleData off = stretchProbeSample(20000, false);
SampleData on = off;
// 30 Hz @ 44.1k: periodAlignedJump takes ONE whole period (1470), which cannot fit twice
// inside the shifter's reachable jump bound — a different splice geometry from the fixed
// 2205-frame window, so a wire failure here cannot pass by coincidence.
on.sourcePeriodFrames = 1470.0;
std::vector<AudioSample> lOff(n), lOn(n), rUnused;
renderVoice(off, /*note=*/67, /*rate=*/1.0, w, false, lOff, rUnused); // +7 st: real splices
renderVoice(on, 67, 1.0, w, false, lOn, rUnused);
CHECK(hashStream(lOff) != hashStream(lOn));
}
// --- Rate changes DURATION only; the transposition alone sets pitch. ---
static void testPreserveStretchChangesDurationNotPitch() {
// Gate, no loop: the voice's life is exactly how long the source lasts, so the frame at
@@ -3419,6 +3438,7 @@ int main() {
// The Preserve read path's stretch generalization.
testPreserveUnityRateIsBitIdenticalToTheShippedRead();
testSourcePeriodChangesTheRenderedStream();
testPreserveStretchChangesDurationNotPitch();
testPreserveStretchSpeaksOnFrameZeroAtEveryRate();
testPreserveStretchLoopsTheSourceSpan();