新增了耳机音量保护

This commit is contained in:
eafonyang
2026-09-21 09:28:56 +08:00
parent cc818fe26e
commit 2777770913
10 changed files with 584 additions and 12 deletions
+48 -12
View File
@@ -3,7 +3,8 @@
Design: Reference luxsin_x8_音频设置.png
Sections:
- 平衡与灵敏度: 左右平衡 slider, VU灵敏度 slider
- 输出特性: 滤波特性, 耳机增益, 音量幅度
- 输出特性: 滤波特性, 动态范围增强, 音量幅度
- 耳机设定: 耳机增益, 自动检测耳机阻抗, 耳机最大音量, 耳机启动音量(后两项 version >= 31 才显示)
- IIS设置: IIS静音电平, IIS模式
- 系统与接口: 开机音量, XLR极性
All list rows → navigate to /select page
@@ -14,7 +15,7 @@ import { useLocation } from "wouter";
import { useState, useEffect, useRef } from "react";
import BottomNav from "@/components/BottomNav";
import { navigateToSelect } from "./SelectPage";
import { getBootSoundMaxIndex } from "@/config/firmwareFeatures";
import { getBootSoundMaxIndex, supportsHpVolumeSettings } from "@/config/firmwareFeatures";
import {
normalizeBootSound,
parseFirmwareVersion,
@@ -110,6 +111,7 @@ type LocaleDac = {
dac?: {
sectionBalanceSensitivity?: string;
sectionOutput?: string;
sectionHpSettings?: string;
sectionIisSettings?: string;
sectionSystemInterface?: string;
balance?: string;
@@ -117,6 +119,8 @@ type LocaleDac = {
filters?: { label?: string; options?: Array<{ index: number; label: string }> };
dacGain?: { label?: string; options?: Array<{ index: number; label: string }> };
autoImpedance?: { label?: string; options?: Array<{ index: number; label: string }> };
hpMaxVolume?: { label?: string; options?: Array<{ index: number; label: string }> };
hpStartupVolume?: { 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 }> };
@@ -216,6 +220,8 @@ export default function AudioPage() {
const gainIdx = ds?.dacGain ?? 0;
const autoImpedanceOn = (ds?.dacImpedance ?? 0) === 1;
const hpMaxVolumeIdx = Math.min(Math.max(ds?.hpMaxVolume ?? 0, 0), 10);
const hpStartupVolumeIdx = Math.min(Math.max(ds?.hpStartupVolume ?? 0, 0), 7);
const dreModeOn = (ds?.dreMode ?? 0) === 1;
const dacVolumeDirectIdx = Math.min(Math.max(ds?.dacVolumeDirect ?? 0, 0), 2);
const stepIdx = ds?.soundStep ?? 1;
@@ -226,6 +232,7 @@ export default function AudioPage() {
const uacVerIdx = Math.min(Math.max(ds?.uac_ver ?? 0, 0), 1);
const bootSoundVal = normalizeBootSound(localBootSound);
const firmwareVersion = parseFirmwareVersion(ds?.version);
const showHpVolumeSettings = supportsHpVolumeSettings(firmwareVersion);
const bootSoundMaxIdx = getBootSoundMaxIndex(firmwareVersion);
const bootSoundSelectIdx = Math.min(bootSoundVal, bootSoundMaxIdx);
const BOOT_VOLUME_OPTIONS = bootVolumeOptions(dacText, bootSoundMaxIdx);
@@ -241,6 +248,12 @@ export default function AudioPage() {
"-12dB",
]);
const UAC_VER_OPTIONS = optionLabels(dacText.uacVer?.options, ["UAC 2.0", "UAC 1.0"]);
const HP_MAX_VOLUME_OPTIONS = optionLabels(dacText.hpMaxVolume?.options, [
"0dB", "-5dB", "-10dB", "-15dB", "-20dB", "-25dB", "-30dB", "-35dB", "-40dB", "-45dB", "-50dB",
]);
const HP_STARTUP_VOLUME_OPTIONS = optionLabels(dacText.hpStartupVolume?.options, [
"默认", "-20dB", "-25dB", "-30dB", "-35dB", "-40dB", "-45dB", "-50dB",
]);
const pageTitle = usePageTitleWithConnection(localeData.home?.audioSet ?? "Audio");
@@ -322,16 +335,6 @@ export default function AudioPage() {
value={FILTER_OPTIONS[filterIdx] ?? FILTER_OPTIONS[0] ?? "—"}
onClick={() => goSelect(dacText.filters?.label ?? "选择滤波特性", FILTER_OPTIONS, filterIdx, "filterCharacteristic")}
/>
<ListRow
label={dacText.dacGain?.label ?? "耳机增益"}
value={GAIN_OPTIONS[gainIdx] ?? GAIN_OPTIONS[0] ?? "—"}
onClick={() => goSelect(dacText.dacGain?.label ?? "选择耳机增益", GAIN_OPTIONS, gainIdx, "dacGain")}
/>
<ToggleRow
label={dacText.autoImpedance?.label ?? "自动检测耳机阻抗"}
checked={autoImpedanceOn}
onChange={(v) => updateSetting({ dacImpedance: v ? 1 : 0 })}
/>
<ToggleRow
label={dacText.dreMode?.label ?? "动态范围增强"}
checked={dreModeOn}
@@ -356,6 +359,39 @@ export default function AudioPage() {
/>
</div>
{/* ── 耳机设定 ── */}
<SectionHeader title={dacText.sectionHpSettings ?? "耳机设定"} />
<div className="ios-list-group">
<ListRow
label={dacText.dacGain?.label ?? "耳机增益"}
value={GAIN_OPTIONS[gainIdx] ?? GAIN_OPTIONS[0] ?? "—"}
onClick={() => goSelect(dacText.dacGain?.label ?? "选择耳机增益", GAIN_OPTIONS, gainIdx, "dacGain")}
/>
<ToggleRow
label={dacText.autoImpedance?.label ?? "自动检测耳机阻抗"}
checked={autoImpedanceOn}
onChange={(v) => updateSetting({ dacImpedance: v ? 1 : 0 })}
/>
{showHpVolumeSettings && (
<>
<ListRow
label={dacText.hpMaxVolume?.label ?? "耳机最大音量"}
value={HP_MAX_VOLUME_OPTIONS[hpMaxVolumeIdx] ?? HP_MAX_VOLUME_OPTIONS[0] ?? "—"}
onClick={() =>
goSelect(dacText.hpMaxVolume?.label ?? "耳机最大音量", HP_MAX_VOLUME_OPTIONS, hpMaxVolumeIdx, "hpMaxVolume")
}
/>
<ListRow
label={dacText.hpStartupVolume?.label ?? "耳机启动音量"}
value={HP_STARTUP_VOLUME_OPTIONS[hpStartupVolumeIdx] ?? HP_STARTUP_VOLUME_OPTIONS[0] ?? "—"}
onClick={() =>
goSelect(dacText.hpStartupVolume?.label ?? "耳机启动音量", HP_STARTUP_VOLUME_OPTIONS, hpStartupVolumeIdx, "hpStartupVolume")
}
/>
</>
)}
</div>
{/* ── IIS 设置 ── */}
<SectionHeader title={dacText.sectionIisSettings ?? "IIS设置"} />
<div className="ios-list-group">