fix(client): list only real audio devices and persist the choice by id

The device pickers showed every ALSA PCM plugin (Discard all samples, Rate
Converter, JACK, Open Sound System, surround/dmix aliases). Enumeration now
goes through a pure filter that keeps the system default, the PipeWire and
PulseAudio servers and one entry per hardware endpoint, with technical tails
removed and a stable sort.

Selections are stored by device id instead of list position, so the filter
and hotplug cannot move a saved choice. Indexes saved by older versions are
migrated by device name; a missing device falls back to the default.

The same preferences change records whether the voice mode was chosen by
the person: a profile that only carries the old push-to-talk default now
starts in voice activation, explicit choices are kept.
This commit is contained in:
Loki 2026-10-24 23:59:27 +02:00
parent 82dd9a324d
commit 3b95df9e9c
Signed by: boba
GPG key ID: 253067914055423B
17 changed files with 780 additions and 210 deletions

View file

@ -3,7 +3,6 @@ mod media;
pub use media::MediaMixer;
mod playback;
use cpal::traits::DeviceTrait;
use std::sync::{
Arc, Mutex,
atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering},
@ -110,18 +109,12 @@ impl AudioPipeline {
}
pub fn start(cfg: PipelineConfig) -> anyhow::Result<AudioPipeline> {
let input = devices::input_at(cfg.mic_device_index)?;
let output = devices::output_at(cfg.output_device_index)?;
let input = devices::open_input(&cfg.mic_device_id)?;
let output = devices::open_output(&cfg.output_device_id)?;
info!(
"audio in: {} out: {}",
input
.description()
.map(|d| d.name().to_owned())
.unwrap_or_default(),
output
.description()
.map(|d| d.name().to_owned())
.unwrap_or_default()
devices::device_name(&input),
devices::device_name(&output)
);
let in_cfg = config::AudioConfig::find(&input, true)?;