diff --git a/src/system/audio.py b/src/system/audio.py index 1548a02..78bab91 100644 --- a/src/system/audio.py +++ b/src/system/audio.py @@ -353,10 +353,18 @@ class AudioSystem: "JACK started: period=%d, nperiods=%d, rate=%d", profile["period"], profile["nperiods"], profile["rate"], ) - # Auto-connect ports if enabled - if self.config.auto_connect: - self.connect_fx_ports() - return True + # Stabilization check — JACK can start briefly then crash + # if the ALSA device is flaky. Wait 1.5s with retries. + time.sleep(0.5) + if _jack_is_operational(): + # Auto-connect ports if enabled + if self.config.auto_connect: + self.connect_fx_ports() + return True + # JACK was running but dropped — don't return yet, + # continue the wait loop for a fresh attempt + logger.warning("JACK appeared briefly then became non-operational") + continue # JACK process exists but not ready yet — keep waiting continue