新增音量保护
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
Design: Reference luxsin_x8_音频设置.png
|
||||
Sections:
|
||||
- 平衡与灵敏度: 左右平衡, VU灵敏度, 模拟输入增益 sliders
|
||||
- 输出特性: 滤波特性, 耳机增益, 音量幅度
|
||||
- 输出特性: 滤波特性, 前级输出音量直通模式, ARC模式, 音量幅度
|
||||
- 耳机设定: 耳机增益, 自动检测耳机阻抗, 耳机最大音量, 耳机启动音量(后两项 version >= 2011 才显示)
|
||||
- 系统与接口: 开机音量, XLR极性
|
||||
All list rows → navigate to /select page
|
||||
============================================================ */
|
||||
@@ -13,6 +14,7 @@ import { useLocation } from "wouter";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import BottomNav from "@/components/BottomNav";
|
||||
import { navigateToSelect } from "./SelectPage";
|
||||
import { supportsHpVolumeSettings } from "@/config/firmwareFeatures";
|
||||
import {
|
||||
getBootSoundMaxIndex,
|
||||
normalizeBootSound,
|
||||
@@ -107,6 +109,7 @@ type LocaleDac = {
|
||||
dac?: {
|
||||
sectionBalanceSensitivity?: string;
|
||||
sectionOutput?: string;
|
||||
sectionHpSettings?: string;
|
||||
sectionSystemInterface?: string;
|
||||
balance?: string;
|
||||
sensitivity?: string;
|
||||
@@ -114,6 +117,8 @@ type LocaleDac = {
|
||||
autoImpedanceDetection?: string;
|
||||
filters?: { label?: string; options?: Array<{ index: number; label: string }> };
|
||||
dacGain?: { 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 }> };
|
||||
dacVolumeDirect?: { label?: string; options?: Array<{ index: number; label: string }> };
|
||||
dacArc?: { label?: string; options?: Array<{ index: number; label: string }> };
|
||||
volumeStep?: string;
|
||||
@@ -217,6 +222,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 dacVolumeDirectIdx = ds?.dacVolumeDirect ?? 0;
|
||||
const dacArcIdx = ds?.dacArc ?? 0;
|
||||
const stepIdx = ds?.soundStep ?? 1;
|
||||
@@ -224,6 +231,7 @@ export default function AudioPage() {
|
||||
const xlrIdx = ds?.xlr ?? 0;
|
||||
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);
|
||||
@@ -233,6 +241,12 @@ export default function AudioPage() {
|
||||
const DAC_VOLUME_DIRECT_OPTIONS = optionLabels(dacText.dacVolumeDirect?.options, ["关闭", "0dB", "-12dB"]);
|
||||
const DAC_ARC_OPTIONS = optionLabels(dacText.dacArc?.options, ["ARC", "EARC"]);
|
||||
const XLR_OPTIONS = optionLabels(dacText.xlr?.options, ["正常", "反转"]);
|
||||
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");
|
||||
|
||||
@@ -338,17 +352,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")}
|
||||
/>
|
||||
<ListRow
|
||||
label={dacText.autoImpedanceDetection ?? "自动检测耳机阻抗"}
|
||||
toggle
|
||||
checked={autoImpedanceOn}
|
||||
onToggle={(v) => updateSetting({ dacImpedance: v ? 1 : 0 })}
|
||||
/>
|
||||
<ListRow
|
||||
label={dacText.dacVolumeDirect?.label ?? "前级输出音量直通模式"}
|
||||
value={DAC_VOLUME_DIRECT_OPTIONS[dacVolumeDirectIdx] ?? DAC_VOLUME_DIRECT_OPTIONS[0] ?? "—"}
|
||||
@@ -380,6 +383,40 @@ 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")}
|
||||
/>
|
||||
<ListRow
|
||||
label={dacText.autoImpedanceDetection ?? "自动检测耳机阻抗"}
|
||||
toggle
|
||||
checked={autoImpedanceOn}
|
||||
onToggle={(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>
|
||||
|
||||
{/* ── 系统与接口 ── */}
|
||||
<SectionHeader title={dacText.sectionSystemInterface ?? "系统与接口"} />
|
||||
<div className="ios-list-group">
|
||||
|
||||
@@ -123,6 +123,10 @@ const KEY_TO_SETTING: Record<string, string> = {
|
||||
|
||||
dacImpedance: "dacImpedance",
|
||||
|
||||
hpMaxVolume: "hpMaxVolume",
|
||||
|
||||
hpStartupVolume: "hpStartupVolume",
|
||||
|
||||
dacVolumeDirect: "dacVolumeDirect",
|
||||
|
||||
dacArc: "dacArc",
|
||||
|
||||
Reference in New Issue
Block a user