From 9863f0235d2bbd76532933ea7ffc24117d015181 Mon Sep 17 00:00:00 2001 From: HiFiPHile Date: Tue, 25 Aug 2026 09:28:12 +0200 Subject: fix(audio): avoid playback alt-setting glitch at startup Enter the microphone-only phase before starting playback when both directions exist. This avoids briefly selecting the playback alternate setting and immediately returning it to alt 0. Signed-off-by: HiFiPHile --- examples/host/audio_host/src/audio_app.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/host/audio_host/src/audio_app.c b/examples/host/audio_host/src/audio_app.c index 553e8f20e..b7421878b 100644 --- a/examples/host/audio_host/src/audio_app.c +++ b/examples/host/audio_host/src/audio_app.c @@ -497,11 +497,13 @@ static void tuh_audio_mount_async(uintptr_t param) { audio_frame_count = spk_config.sample_rate / 1000; spk_init_sine(); // fallback test tone while no capture stream is echoing set_stream_volume(idx, spk_stream_idx, "Speaker"); - spk_ready = tuh_audio_start(idx, spk_stream_idx); - // both streams running: start the periodic phase switching demo - if (mic_ready && spk_ready) { + if (capture_found) { + // Start in the mic-only phase without briefly activating playback first. app_audio_phase_enter(APP_PHASE_MIC_ONLY); + } else { + // Playback-only device: start the sine test tone immediately. + spk_ready = tuh_audio_start(idx, spk_stream_idx); } } -- cgit v1.3.1