summaryrefslogtreecommitdiff
path: root/examples/host/audio_host/src
diff options
context:
space:
mode:
authorHiFiPHile <[email protected]>2026-08-25 09:28:12 +0200
committerHiFiPHile <[email protected]>2026-08-25 09:28:12 +0200
commit9863f0235d2bbd76532933ea7ffc24117d015181 (patch)
treebfd52dc485dc84fe2a44c5c268b0fc402f9004d5 /examples/host/audio_host/src
parentaab34b8d0dafb360213fc40bd3ce33813fdf5cad (diff)
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 <[email protected]>
Diffstat (limited to 'examples/host/audio_host/src')
-rw-r--r--examples/host/audio_host/src/audio_app.c8
1 files changed, 5 insertions, 3 deletions
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);
}
}