From 59b5f9be92cbb74e79bf35daf2aa08bc52a21f94 Mon Sep 17 00:00:00 2001 From: HiFiPHile Date: Tue, 25 Aug 2026 09:27:36 +0200 Subject: fix(audio): configure playback-only example devices Select capture and playback configurations independently in the example. Speaker-only devices can now start playback without a capture configuration. Signed-off-by: HiFiPHile --- examples/host/audio_host/src/audio_app.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/host/audio_host/src/audio_app.c b/examples/host/audio_host/src/audio_app.c index 6639b7ec5..0110bdde8 100644 --- a/examples/host/audio_host/src/audio_app.c +++ b/examples/host/audio_host/src/audio_app.c @@ -480,8 +480,9 @@ static void tuh_audio_mount_async(uintptr_t param) { if (tuh_audio_stream_direction(idx, stream_idx) != TUH_AUDIO_STREAM_PLAYBACK) { continue; } + const uint8_t preferred_channels = capture_found ? mic_config.channels : 2; for (uint8_t n = 0; n < 2 && playback_config_idx == TUSB_INDEX_INVALID_8; n++) { - const uint8_t ch = (n == 0) ? mic_config.channels : (uint8_t)(mic_config.channels == 1 ? 2 : 1); + const uint8_t ch = (n == 0) ? preferred_channels : (uint8_t)(preferred_channels == 1 ? 2 : 1); for (uint8_t i = 0; i < tuh_audio_config_count(idx, stream_idx); i++) { tuh_audio_stream_config_t config; if (tuh_audio_config_get(idx, stream_idx, i, &config) && config.format == TUH_AUDIO_FORMAT_S16_LE && -- cgit v1.3.1