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:
@@ -909,6 +909,23 @@ static void testBuildSampleDataEmptyPcmIsUnplayable() {
|
||||
CHECK(sd.frames.empty());
|
||||
}
|
||||
|
||||
// Major-1 remediation: buildSampleData (sample_map.cpp:333-334) is the ONE call site wiring
|
||||
// load-time detection to SampleData; detectPeriod's own unit coverage (test_period_detect.cpp)
|
||||
// never exercises this call, so a deleted wire passed the gated suite unnoticed. Goes through
|
||||
// the real build, not a direct detectPeriod call.
|
||||
static void testBuildSampleDataDetectsThirtyHertzSourcePeriod() {
|
||||
const int rate = 44100;
|
||||
const std::size_t frames = 30000;
|
||||
std::vector<AudioSample> pcm(frames);
|
||||
for (std::size_t i = 0; i < frames; ++i) {
|
||||
pcm[i] = static_cast<float>(
|
||||
std::sin(2.0 * 3.14159265358979323846 * 30.0 * static_cast<double>(i) / rate));
|
||||
}
|
||||
const SampleData sd = buildSampleData(resolveCapture(ref("b/a.wav", 60), InstrumentParams{}),
|
||||
DecodedPcm{pcm, rate, {}});
|
||||
CHECK(std::fabs(sd.sourcePeriodFrames - 1470.0) < 2.0); // 44100 / 30 Hz
|
||||
}
|
||||
|
||||
static void testBuildSampleDataCarriesTheVelocityCurve() {
|
||||
InstrumentParams p;
|
||||
p.velocityCurve = VelocityCurve::linear();
|
||||
@@ -976,6 +993,7 @@ int main() {
|
||||
testBuildSampleDataDropsMismatchedSecondChannel();
|
||||
testBuildSampleDataEmptyPcmIsUnplayable();
|
||||
testBuildSampleDataCarriesTheVelocityCurve();
|
||||
testBuildSampleDataDetectsThirtyHertzSourcePeriod();
|
||||
|
||||
if (g_fail == 0) std::printf("sample_map: all tests passed\n");
|
||||
return g_fail != 0;
|
||||
|
||||
Reference in New Issue
Block a user