diff --git a/client/src/pages/EQPage.tsx b/client/src/pages/EQPage.tsx index fee403b..d81455c 100644 --- a/client/src/pages/EQPage.tsx +++ b/client/src/pages/EQPage.tsx @@ -53,6 +53,7 @@ import { BAND_Q_MAX, BAND_PARAM_VALUE_BOX_STYLE, DEFAULT_BANDS, + FLAT_BANDS, FLAT_PRESET_FILTERS, PEQ_PRESET_MAX, type BandParamKind, @@ -136,8 +137,8 @@ export default function EQPage() { const [bandsByMode, setBandsByMode] = useState< Record<"A" | "B", typeof DEFAULT_BANDS> >({ - A: cloneBands(DEFAULT_BANDS), - B: cloneBands(DEFAULT_BANDS), + A: cloneBands(FLAT_BANDS), + B: cloneBands(FLAT_BANDS), }); const [selectedBandByMode, setSelectedBandByMode] = useState< Record<"A" | "B", number> @@ -605,7 +606,7 @@ export default function EQPage() { const items = remote.peq ?? []; if (items.length === 0) { - setBandsForBothModes(DEFAULT_BANDS); + setBandsForBothModes(FLAT_BANDS); setSelectedBandByMode({ A: 0, B: 0 }); return; } @@ -1043,7 +1044,7 @@ export default function EQPage() { setHeadphoneModels([]); setPeqItems([]); selectHeadphone(0, ""); - setBandsForBothModes(DEFAULT_BANDS); + setBandsForBothModes(FLAT_BANDS); setSelectedBandByMode({ A: 0, B: 0 }); setCurrentRawCurve(null); } @@ -1102,7 +1103,14 @@ export default function EQPage() { // 切换耳机型号后,从 peqItems 加载该型号的 filters(暂停一次上报避免错写) useEffect(() => { const peq = peqItems[headphoneIdx]; - if (!peq) return; + if (!peq) { + // 列表为空(如设备端删光全部预设):恢复平直曲线并清空 Raw 参考线 + setBandsForBothModes(FLAT_BANDS); + setSelectedBandByMode({ A: 0, B: 0 }); + setCurrentRawCurve(null); + setRawCurveLoading(false); + return; + } const nextBands = normalizeFiltersFromPeq(peq); if (!nextBands.length) return; syncingHeadphoneRef.current = true; diff --git a/client/src/pages/eq/constants.ts b/client/src/pages/eq/constants.ts index 0211b81..a57152a 100644 --- a/client/src/pages/eq/constants.ts +++ b/client/src/pages/eq/constants.ts @@ -55,6 +55,20 @@ export const DEFAULT_BANDS = [ { freq: 10000, gain: 0, q: 1.41, type: "HSHELF", enabled: true }, ]; +/* ── Flat bands:无预设/未加载时展示的平直曲线(10 个 gain=0 的 PEAK) ── */ +export const FLAT_BANDS: typeof DEFAULT_BANDS = [ + { freq: 80, gain: 0, q: 1.41, type: "PEAK", enabled: true }, + { freq: 150, gain: 0, q: 1.41, type: "PEAK", enabled: true }, + { freq: 350, gain: 0, q: 1.41, type: "PEAK", enabled: true }, + { freq: 750, gain: 0, q: 1.41, type: "PEAK", enabled: true }, + { freq: 1500, gain: 0, q: 1.41, type: "PEAK", enabled: true }, + { freq: 3000, gain: 0, q: 1.41, type: "PEAK", enabled: true }, + { freq: 6000, gain: 0, q: 1.41, type: "PEAK", enabled: true }, + { freq: 10000, gain: 0, q: 1.41, type: "PEAK", enabled: true }, + { freq: 14000, gain: 0, q: 1.41, type: "PEAK", enabled: true }, + { freq: 18000, gain: 0, q: 1.41, type: "PEAK", enabled: true }, +]; + /* ── PEQ catalog item type ── */ export type PeqCatalogItem = NonNullable[number];