feat(audio): add PipeWire force bit-perfect mode

Add experimental toggle to force PipeWire clock.force-quantum alongside
clock.force-rate for true bit-perfect playback. Quantum is matched to
sample rate (1024 for <=48kHz, 2048 for <=96kHz, etc). Both values
reset to 0 on stop and pause-suspend to avoid affecting other apps.

Requires DAC Passthrough to be enabled, PipeWire backend only.
This commit is contained in:
vicrodh committed 2026-02-19 18:01:42 -06:00
1 parent 98ffd3dff2
commit cbc2ff0b26
13 files changed
+181 -5

No files matched your search

+16
View File
@@ -4966,6 +4966,7 @@ pub async fn v2_reinit_audio_device(
normalization_enabled: fresh_settings.normalization_enabled,
normalization_target_lufs: fresh_settings.normalization_target_lufs,
gapless_enabled: fresh_settings.gapless_enabled,
pw_force_bitperfect: fresh_settings.pw_force_bitperfect,
};
let _ = player.reload_settings(qbz_settings);
}
@@ -5235,6 +5236,21 @@ pub fn v2_set_audio_dac_passthrough(
store.set_dac_passthrough(enabled).map_err(RuntimeError::Internal)
}
/// Set PipeWire force bit-perfect mode (V2)
#[tauri::command]
pub fn v2_set_audio_pw_force_bitperfect(
enabled: bool,
state: State<'_, AudioSettingsState>,
) -> Result<(), RuntimeError> {
log::info!("[V2] set_audio_pw_force_bitperfect: {}", enabled);
let guard = state
.store
.lock()
.map_err(|e| RuntimeError::Internal(format!("Lock error: {}", e)))?;
let store = guard.as_ref().ok_or(RuntimeError::UserSessionNotActivated)?;
store.set_pw_force_bitperfect(enabled).map_err(RuntimeError::Internal)
}
/// Set preferred sample rate (V2)
#[tauri::command]
pub fn v2_set_audio_sample_rate(