From 33a5b8a9b021a83ac778271ba7f2578c53c62041 Mon Sep 17 00:00:00 2001 From: eafonyang Date: Tue, 8 Sep 2026 14:19:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(api):=20=E6=96=B0=E5=A2=9E=20UAC=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=94=AF=E6=8C=81=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在音频参数中加入 uac_ver 字段,支持区分 UAC 2.0 和 UAC 1.0 - 在多语言资源中添加 UAC 版本选项及对应标签(中英文、德语、西班牙语、法语、繁体中文等) - 在 AudioPage 页面新增 UAC 版本选择组件,支持用户选择不同版本 - 在 SelectPage 中加入 uac_ver 的映射,保证数据正确传递 - 为 UAC 版本选项新增“Custom”自定义项,丰富配置可能性 --- client/src/lib/luxsinApi.ts | 3 +++ client/src/locales/data-de.json | 16 +++++++++++++++- client/src/locales/data-en.json | 16 +++++++++++++++- client/src/locales/data-es.json | 16 +++++++++++++++- client/src/locales/data-fr.json | 16 +++++++++++++++- client/src/locales/data-zh-HK.json | 16 +++++++++++++++- client/src/locales/data-zh.json | 16 +++++++++++++++- client/src/pages/AudioPage.tsx | 8 ++++++++ client/src/pages/SelectPage.tsx | 1 + 9 files changed, 102 insertions(+), 6 deletions(-) diff --git a/client/src/lib/luxsinApi.ts b/client/src/lib/luxsinApi.ts index 103851a..d003fab 100644 --- a/client/src/lib/luxsinApi.ts +++ b/client/src/lib/luxsinApi.ts @@ -101,6 +101,8 @@ export interface DeviceState { dreMode: number; dacVolumeDirect: number; analogGain: number; + /** USB Audio Class version: 0 = UAC 2.0, 1 = UAC 1.0. */ + uac_ver: number; effect_enable: number; effect_value: number; width_enable: number; @@ -488,6 +490,7 @@ export const MOCK_DEVICE_STATE: DeviceState = { dreMode: 0, dacVolumeDirect: 0, analogGain: 0, + uac_ver: 0, effect_enable: 0, effect_value: 50, width_enable: 0, diff --git a/client/src/locales/data-de.json b/client/src/locales/data-de.json index 10ef00c..6f4868b 100644 --- a/client/src/locales/data-de.json +++ b/client/src/locales/data-de.json @@ -168,7 +168,8 @@ "options": [ "BS2B Standard (700 Hz, 4,5 dB)", "BS2B Populär (700 Hz, 6 dB)", - "BS2B Entspannt (650 Hz, 9,5 dB)" + "BS2B Entspannt (650 Hz, 9,5 dB)", + "Custom" ] }, "subwoofer": { @@ -588,6 +589,19 @@ } ] }, + "uacVer": { + "label": "UAC-Version", + "options": [ + { + "index": 0, + "label": "UAC 2.0" + }, + { + "index": 1, + "label": "UAC 1.0" + } + ] + }, "arc": { "label": "ARC-Modus", "options": [ diff --git a/client/src/locales/data-en.json b/client/src/locales/data-en.json index 1a85673..f050cce 100644 --- a/client/src/locales/data-en.json +++ b/client/src/locales/data-en.json @@ -168,7 +168,8 @@ "options": [ "BS2B default (700 Hz, 4.5 dB)", "BS2B popular (700 Hz, 6 dB)", - "BS2B relax (650 Hz, 9.5 dB)" + "BS2B relax (650 Hz, 9.5 dB)", + "Custom" ] }, "subwoofer": { @@ -588,6 +589,19 @@ } ] }, + "uacVer": { + "label": "UAC Version", + "options": [ + { + "index": 0, + "label": "UAC 2.0" + }, + { + "index": 1, + "label": "UAC 1.0" + } + ] + }, "arc": { "label": "ARC mode", "options": [ diff --git a/client/src/locales/data-es.json b/client/src/locales/data-es.json index 2bf6ec3..f17b365 100644 --- a/client/src/locales/data-es.json +++ b/client/src/locales/data-es.json @@ -168,7 +168,8 @@ "options": [ "BS2B predeterminado (700 Hz, 4,5 dB)", "BS2B popular (700 Hz, 6 dB)", - "BS2B relajado (650 Hz, 9,5 dB)" + "BS2B relajado (650 Hz, 9,5 dB)", + "Custom" ] }, "subwoofer": { @@ -588,6 +589,19 @@ } ] }, + "uacVer": { + "label": "Versión UAC", + "options": [ + { + "index": 0, + "label": "UAC 2.0" + }, + { + "index": 1, + "label": "UAC 1.0" + } + ] + }, "arc": { "label": "Modo ARC", "options": [ diff --git a/client/src/locales/data-fr.json b/client/src/locales/data-fr.json index 088cccc..40dd47f 100644 --- a/client/src/locales/data-fr.json +++ b/client/src/locales/data-fr.json @@ -168,7 +168,8 @@ "options": [ "BS2B défaut (700 Hz, 4,5 dB)", "BS2B populaire (700 Hz, 6 dB)", - "BS2B relax (650 Hz, 9,5 dB)" + "BS2B relax (650 Hz, 9,5 dB)", + "Custom" ] }, "subwoofer": { @@ -588,6 +589,19 @@ } ] }, + "uacVer": { + "label": "Version UAC", + "options": [ + { + "index": 0, + "label": "UAC 2.0" + }, + { + "index": 1, + "label": "UAC 1.0" + } + ] + }, "arc": { "label": "Mode ARC", "options": [ diff --git a/client/src/locales/data-zh-HK.json b/client/src/locales/data-zh-HK.json index 92c8ca7..3f26afe 100644 --- a/client/src/locales/data-zh-HK.json +++ b/client/src/locales/data-zh-HK.json @@ -168,7 +168,8 @@ "options": [ "BS2B default(700Hz,4.5dB)", "BS2B polular(700Hz,6dB)", - "BS2B relax(650Hz,9.5dB)" + "BS2B relax(650Hz,9.5dB)", + "Custom" ] }, "subwoofer": { @@ -588,6 +589,19 @@ } ] }, + "uacVer": { + "label": "UAC版本", + "options": [ + { + "index": 0, + "label": "UAC 2.0" + }, + { + "index": 1, + "label": "UAC 1.0" + } + ] + }, "arc": { "label": "ARC模式", "options": [ diff --git a/client/src/locales/data-zh.json b/client/src/locales/data-zh.json index 5e52baf..2b1491e 100644 --- a/client/src/locales/data-zh.json +++ b/client/src/locales/data-zh.json @@ -168,7 +168,8 @@ "options": [ "BS2B default(700Hz,4.5dB)", "BS2B polular(700Hz,6dB)", - "BS2B relax(650Hz,9.5dB)" + "BS2B relax(650Hz,9.5dB)", + "Custom" ] }, "subwoofer": { @@ -588,6 +589,19 @@ } ] }, + "uacVer": { + "label": "UAC版本", + "options": [ + { + "index": 0, + "label": "UAC 2.0" + }, + { + "index": 1, + "label": "UAC 1.0" + } + ] + }, "arc": { "label": "ARC模式", "options": [ diff --git a/client/src/pages/AudioPage.tsx b/client/src/pages/AudioPage.tsx index 954fa65..774eae2 100644 --- a/client/src/pages/AudioPage.tsx +++ b/client/src/pages/AudioPage.tsx @@ -119,6 +119,7 @@ type LocaleDac = { autoImpedance?: { label?: string; options?: Array<{ index: number; label: string }> }; dreMode?: { label?: string; options?: Array<{ index: number; label: string }> }; dacVolumeDirect?: { label?: string; options?: Array<{ index: number; label: string }> }; + uacVer?: { label?: string; options?: Array<{ index: number; label: string }> }; volumeStep?: string; bootVolume?: string | { label?: string; options?: Array<{ index: number; label: string }> }; xlr?: { label?: string; options?: Array<{ index: number; label: string }> }; @@ -222,6 +223,7 @@ export default function AudioPage() { const xlrIdx = ds?.xlr ?? 0; const mutePolarIdx = (ds as ({ hdmimutepolar?: number } | null))?.hdmimutepolar ?? 0; const iisModeIdx = (ds as ({ hdmiType?: number } | null))?.hdmiType ?? 0; + const uacVerIdx = Math.min(Math.max(ds?.uac_ver ?? 0, 0), 1); const bootSoundVal = normalizeBootSound(localBootSound); const firmwareVersion = parseFirmwareVersion(ds?.version); const bootSoundMaxIdx = getBootSoundMaxIndex(firmwareVersion); @@ -238,6 +240,7 @@ export default function AudioPage() { "0dB", "-12dB", ]); + const UAC_VER_OPTIONS = optionLabels(dacText.uacVer?.options, ["UAC 2.0", "UAC 1.0"]); const pageTitle = usePageTitleWithConnection(localeData.home?.audioSet ?? "Audio"); @@ -388,6 +391,11 @@ export default function AudioPage() { value={XLR_OPTIONS[xlrIdx] ?? XLR_OPTIONS[0] ?? "—"} onClick={() => goSelect(dacText.xlr?.label ?? "选择 XLR 极性", XLR_OPTIONS, xlrIdx, "xlr")} /> + goSelect(dacText.uacVer?.label ?? "选择 UAC 版本", UAC_VER_OPTIONS, uacVerIdx, "uacVer")} + /> diff --git a/client/src/pages/SelectPage.tsx b/client/src/pages/SelectPage.tsx index 03410dc..fc7f49b 100644 --- a/client/src/pages/SelectPage.tsx +++ b/client/src/pages/SelectPage.tsx @@ -52,6 +52,7 @@ const KEY_TO_SETTING: Record = { dacGain: "dacGain", dacImpedance: "dacImpedance", dacVolumeDirect: "dacVolumeDirect", + uacVer: "uac_ver", vu: "vu", input: "input", output: "output",