修复bug
This commit is contained in:
@@ -70,6 +70,15 @@ function SectionHeader({ title }: { title: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
function IOSToggle({ checked, onChange }: { checked: boolean; onChange: (v: boolean) => void }) {
|
||||
return (
|
||||
<label className="ios-toggle" onClick={(e) => e.stopPropagation()}>
|
||||
<input type="checkbox" checked={checked} onChange={(e) => onChange(e.target.checked)} />
|
||||
<span className="ios-toggle-track"><span className="ios-toggle-thumb" /></span>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
function ListRow({ label, value, onClick }: { label: string; value: string; onClick?: () => void }) {
|
||||
return (
|
||||
<button className="ios-list-row w-full text-left active:bg-white/5 transition-colors" onClick={onClick}>
|
||||
@@ -80,6 +89,23 @@ function ListRow({ label, value, onClick }: { label: string; value: string; onCl
|
||||
);
|
||||
}
|
||||
|
||||
function ToggleRow({
|
||||
label,
|
||||
checked,
|
||||
onChange,
|
||||
}: {
|
||||
label: string;
|
||||
checked: boolean;
|
||||
onChange: (v: boolean) => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="ios-list-row">
|
||||
<span className="flex-1 text-[16px] text-white">{label}</span>
|
||||
<IOSToggle checked={checked} onChange={onChange} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
type LocaleDac = {
|
||||
dac?: {
|
||||
sectionBalanceSensitivity?: string;
|
||||
@@ -90,6 +116,9 @@ type LocaleDac = {
|
||||
sensitivity?: string;
|
||||
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 }> };
|
||||
dreMode?: { label?: string; options?: Array<{ index: number; label: string }> };
|
||||
dacVolumeDirect?: { 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 }> };
|
||||
@@ -192,6 +221,9 @@ export default function AudioPage() {
|
||||
}, [location, isConnected, api, refresh]);
|
||||
|
||||
const gainIdx = ds?.dacGain ?? 0;
|
||||
const autoImpedanceOn = (ds?.dacImpedance ?? 0) === 1;
|
||||
const dreModeOn = (ds?.dreMode ?? 0) === 1;
|
||||
const dacVolumeDirectIdx = Math.min(Math.max(ds?.dacVolumeDirect ?? 0, 0), 2);
|
||||
const stepIdx = ds?.soundStep ?? 1;
|
||||
const filterIdx = ds?.pcm ?? 0;
|
||||
const xlrIdx = ds?.xlr ?? 0;
|
||||
@@ -208,6 +240,11 @@ export default function AudioPage() {
|
||||
const XLR_OPTIONS = optionLabels(dacText.xlr?.options, ["正常", "反转"]);
|
||||
const MUTE_POLAR_OPTIONS = optionLabels(dacText.mutePolar?.options, ["低电平", "高电平"]);
|
||||
const IIS_MODE_OPTIONS = optionLabels(dacText.IISMode?.options, ["模式1", "模式2", "模式3", "模式4", "模式5", "模式6", "模式7", "模式8"]);
|
||||
const DAC_VOLUME_DIRECT_OPTIONS = optionLabels(dacText.dacVolumeDirect?.options, [
|
||||
"关闭",
|
||||
"0dB",
|
||||
"-12dB",
|
||||
]);
|
||||
|
||||
const goSelect = (title: string, options: string[], selected: number, key: string) => {
|
||||
navigateToSelect(title, options, selected, "/audio", key);
|
||||
@@ -292,6 +329,28 @@ export default function AudioPage() {
|
||||
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}
|
||||
onChange={(v) => updateSetting({ dreMode: v ? 1 : 0 })}
|
||||
/>
|
||||
<ListRow
|
||||
label={dacText.dacVolumeDirect?.label ?? "前级输出音量直通模式"}
|
||||
value={DAC_VOLUME_DIRECT_OPTIONS[dacVolumeDirectIdx] ?? DAC_VOLUME_DIRECT_OPTIONS[0] ?? "—"}
|
||||
onClick={() =>
|
||||
goSelect(
|
||||
dacText.dacVolumeDirect?.label ?? "前级输出音量直通模式",
|
||||
DAC_VOLUME_DIRECT_OPTIONS,
|
||||
dacVolumeDirectIdx,
|
||||
"dacVolumeDirect",
|
||||
)
|
||||
}
|
||||
/>
|
||||
<ListRow
|
||||
label={dacText.volumeStep ?? "音量幅度"}
|
||||
value={STEP_OPTIONS[stepIdx] ?? STEP_OPTIONS[0]}
|
||||
|
||||
Reference in New Issue
Block a user