diff options
| author | HiFiPHile <[email protected]> | 2026-08-25 09:27:36 +0200 |
|---|---|---|
| committer | HiFiPHile <[email protected]> | 2026-08-25 09:27:36 +0200 |
| commit | 59b5f9be92cbb74e79bf35daf2aa08bc52a21f94 (patch) | |
| tree | daf88f0ebc772df5133f3a0c28787f483cd45f54 /examples/host/audio_host | |
| parent | b26958c47e70d659620ec391731b37c6d1c66ea7 (diff) | |
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 <[email protected]>
Diffstat (limited to 'examples/host/audio_host')
| -rw-r--r-- | examples/host/audio_host/src/audio_app.c | 3 |
1 files changed, 2 insertions, 1 deletions
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 && |
