fix: increase listen duration and add RMS logging in WAV load test

Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-11 21:39:49 +00:00
parent 54fa307360
commit 7d842163a2

View File

@@ -944,15 +944,17 @@ static int test_wav_load(void) {
unlink("loop.wav"); unlink("loop.wav");
return 1; return 1;
} }
safe_usleep(4000000); safe_usleep(6000000); /* 6 seconds to ensure loop is heard */
jack_deactivate(client); jack_deactivate(client);
jack_client_close(client); jack_client_close(client);
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
unlink("loop.wav"); unlink("loop.wav");
int got_bursts = bursts; int got_bursts = bursts;
printf(" detected bursts: %d\n", got_bursts); double rms = passthrough_total_samples > 0 ?
sqrt(passthrough_sum_sq / passthrough_total_samples) : 0.0;
printf(" detected bursts: %d, RMS: %.6f\n", got_bursts, rms);
if (got_bursts < 3) { if (got_bursts < 3) {
fprintf(stderr, " FAIL: expected ≥3 bursts from loaded loop, got %d\n", got_bursts); fprintf(stderr, " FAIL: expected ≥3 bursts from loaded loop, got %d, RMS=%.6f\n", got_bursts, rms);
return 1; return 1;
} }
printf(" PASS (loaded loop plays)\n"); printf(" PASS (loaded loop plays)\n");