fix(slint): correct BP marking and widen the output-device list
The BP badge marked every ALSA device; it now marks only the direct hardware PCMs (hw:/front:/iec958:/hdmi:), matching Tauri — sysdefault and plug devices are not bit-perfect. The device list also opens at 480px (right-anchored) so the full card + PCM id name is readable instead of being elided in a 300px control. cc
This commit is contained in:
3 files changed
+26
-6
No files matched your search
@@ -156,12 +156,20 @@ struct DeviceList {
|
||||
bp: Vec<bool>,
|
||||
}
|
||||
|
||||
/// Whether a device can deliver bit-perfect playback on `backend`. ALSA
|
||||
/// enumerates real `hw:` cards (always capable); PipeWire reports a
|
||||
/// hardware flag per node; PulseAudio always mixes, so never capable.
|
||||
/// Whether a device can deliver bit-perfect playback on `backend`. On
|
||||
/// ALSA only the direct-hardware PCMs qualify (`hw:` / `front:` and the
|
||||
/// digital `iec958:` / `hdmi:`) — `sysdefault:`, `plughw:` and friends
|
||||
/// route through converting plugins. PipeWire reports a hardware flag
|
||||
/// per node; PulseAudio always mixes, so never capable.
|
||||
fn device_is_bit_perfect(backend: AudioBackendType, device: &qbz_audio::AudioDevice) -> bool {
|
||||
match backend {
|
||||
AudioBackendType::Alsa => true,
|
||||
AudioBackendType::Alsa => {
|
||||
let id = device.id.to_ascii_lowercase();
|
||||
id.starts_with("hw:")
|
||||
|| id.starts_with("front:")
|
||||
|| id.starts_with("iec958:")
|
||||
|| id.starts_with("hdmi:")
|
||||
}
|
||||
AudioBackendType::PipeWire => device.is_hardware,
|
||||
AudioBackendType::Pulse | AudioBackendType::SystemDefault => false,
|
||||
}
|
||||
|
||||
@@ -27,9 +27,16 @@ export component QbzSelect inherits Rectangle {
|
||||
in property <[bool]> badges: [];
|
||||
in property <int> current-index: 0;
|
||||
in property <length> menu-width: 240px;
|
||||
// Optional: a wider open list than the collapsed control, for long
|
||||
// option labels (device names). 0px keeps the list at `menu-width`.
|
||||
in property <length> popup-width: 0px;
|
||||
in property <bool> enabled: true;
|
||||
callback selected(int);
|
||||
|
||||
// Resolved width of the open list.
|
||||
private property <length> list-width:
|
||||
root.popup-width > root.menu-width ? root.popup-width : root.menu-width;
|
||||
|
||||
width: root.menu-width;
|
||||
height: 34px;
|
||||
border-radius: Radius.sm;
|
||||
@@ -79,9 +86,11 @@ export component QbzSelect inherits Rectangle {
|
||||
}
|
||||
|
||||
popup := PopupWindow {
|
||||
x: 0;
|
||||
// Right-anchored so a list wider than the control grows leftward
|
||||
// and stays on-screen.
|
||||
x: root.menu-width - root.list-width;
|
||||
y: root.height + 4px;
|
||||
width: root.menu-width;
|
||||
width: root.list-width;
|
||||
height: root.options.length * 32px + 10px;
|
||||
|
||||
Rectangle {
|
||||
|
||||
@@ -95,6 +95,9 @@ export component AudioSettings inherits VerticalLayout {
|
||||
description: @tr("The DAC or sound device that receives audio.");
|
||||
QbzSelect {
|
||||
menu-width: 300px;
|
||||
// Device labels run long; open the list wider so the full
|
||||
// name (card + ALSA PCM id) is readable.
|
||||
popup-width: 480px;
|
||||
options: SettingsState.devices;
|
||||
badges: SettingsState.device-bp;
|
||||
current-index: SettingsState.device-index;
|
||||
|
||||
Reference in new issue
Block a user