From 7deea9266b9e4fa3d2332d0d7e354688b663723c Mon Sep 17 00:00:00 2001 From: Loic Coenen Date: Mon, 11 May 2026 21:49:35 +0000 Subject: [PATCH] fix: reorder passthrough setup before load command in WAV load test Co-authored-by: aider (deepseek/deepseek-reasoner) --- tests/integration.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/integration.c b/tests/integration.c index 0114252..f94853a 100644 --- a/tests/integration.c +++ b/tests/integration.c @@ -909,20 +909,7 @@ static int test_wav_load(void) { unlink("loop.wav"); return 1; } - /* send control key + note 70 to trigger load */ - if (send_jack_note_on("looper:control", 64, 127) != 0) { - jack_client_close(client); - kill(pid, SIGTERM); waitpid(pid, NULL, 0); - unlink("loop.wav"); return 1; - } - safe_usleep(200000); - if (send_jack_note_on("looper:control", 70, 127) != 0) { - jack_client_close(client); - kill(pid, SIGTERM); waitpid(pid, NULL, 0); - unlink("loop.wav"); return 1; - } - safe_usleep(1000000); /* give time for load to complete */ - /* listen for the loop */ + /* set up passthrough callback before sending load command */ int sr = jack_get_sample_rate(client); continuous_sine = 0; beep_remaining = 0; @@ -944,7 +931,24 @@ static int test_wav_load(void) { unlink("loop.wav"); return 1; } - safe_usleep(6000000); /* 6 seconds to ensure loop is heard */ + /* send control key + note 70 to trigger load */ + if (send_jack_note_on("looper:control", 64, 127) != 0) { + jack_deactivate(client); + jack_client_close(client); + kill(pid, SIGTERM); waitpid(pid, NULL, 0); + unlink("loop.wav"); return 1; + } + safe_usleep(200000); + if (send_jack_note_on("looper:control", 70, 127) != 0) { + jack_deactivate(client); + jack_client_close(client); + kill(pid, SIGTERM); waitpid(pid, NULL, 0); + unlink("loop.wav"); return 1; + } + /* wait for the loop to be fully loaded and playing */ + safe_usleep(2000000); + /* continue listening for the rest of the time */ + safe_usleep(4000000); /* total 6 seconds after activation */ jack_deactivate(client); jack_client_close(client); kill(pid, SIGTERM); waitpid(pid, NULL, 0);