修复bug

This commit is contained in:
yangy
2026-05-27 13:52:16 +08:00
parent 63a9364ce9
commit 8cde820467
8 changed files with 71 additions and 31 deletions
+16
View File
@@ -171,6 +171,9 @@ export interface PeqApplyPayload {
export const INPUT_LABELS = ["USB", "USB-C", "Coaxial", "Optical", "Bluetooth", "IIS", "RCA"];
export const OUTPUT_LABELS = ["XLR", "RCA", "Headset", "XLR/RCA"];
/** Device `input` index for Bluetooth source. */
export const INPUT_BLUETOOTH_INDEX = 4;
/** Device `output` index for headphone / headset. */
export const OUTPUT_HEADSET_INDEX = 2;
export const LANGUAGE_LABELS = ["English", "繁體中文", "简体中文"];
@@ -345,6 +348,19 @@ export function parseFirmwareVersion(version: unknown): number {
return Number(parts[parts.length - 1]);
}
/** Display firmware version as X.Y.0.Z (e.g. 2005 → 2.0.0.5). */
export function formatFirmwareVersionDisplay(version: unknown): string {
if (version === null || version === undefined || String(version).trim() === "") {
return "—";
}
const n = parseFirmwareVersion(version);
const major = Math.floor(n / 1000);
const minor = Math.floor((n % 1000) / 100);
const patch = 0;
const build = n % 10;
return `${major}.${minor}.${patch}.${build}`;
}
/** Pre-out volume passthrough mode selected (0dB or -12dB). */
export function isVolumePassthroughActive(dacVolumeDirect: number | undefined): boolean {
return dacVolumeDirect === 1 || dacVolumeDirect === 2;