import type { CSSProperties } from "react"; import type { PeqFilter, PeqState } from "@/lib/luxsinApi"; import localeZh from "@/locales/data-zh.json"; /* ── Filter types ── */ export const FILTER_TYPES = [ "LPF", "HPF", "BPF", "NOTCH", "PEAK", "LSHELF", "HSHELF", "APF", ]; /* ── Band parameter ranges ── */ export const BAND_FREQ_MIN = 20; export const BAND_FREQ_MAX = 20000; export const BAND_GAIN_MIN = -15; export const BAND_GAIN_MAX = 15; export const BAND_Q_MIN = 0.1; export const BAND_Q_MAX = 10; /** Maximum headphone PEQ presets stored on device. */ export const PEQ_PRESET_MAX = 50; export type BandParamKind = "freq" | "gain" | "q"; /* ── Band param value box style ── */ export const BAND_PARAM_VALUE_BOX_STYLE: CSSProperties = { background: "rgba(44,44,46,0.9)", border: "1px solid rgba(255,255,255,0.08)", }; /* ── EQ UI locale type ── */ export type PeqEqUi = NonNullable< NonNullable<(typeof localeZh)["peq"]>["eqUi"] >; /* ── Default bands matching reference image ── */ export const DEFAULT_BANDS = [ { freq: 9500, gain: 0, q: 1.41, type: "LSHELF", enabled: true }, { freq: 9200, gain: -2, q: 1.41, type: "PEAK", enabled: true }, { freq: 220, gain: 1, q: 1.41, type: "PEAK", enabled: true }, { freq: 500, gain: -3, q: 1.41, type: "PEAK", enabled: true }, { freq: 1200, gain: 0, q: 1.41, type: "PEAK", enabled: true }, { freq: 13800, gain: -1, q: 1.41, type: "NOTCH", enabled: true }, { freq: 11000, gain: -2, q: 1.41, type: "PEAK", enabled: true }, { freq: 7400, gain: 1, q: 1.41, type: "PEAK", enabled: true }, { freq: 8200, gain: -1, q: 1.41, type: "PEAK", enabled: true }, { freq: 10000, gain: 0, q: 1.41, type: "HSHELF", enabled: true }, ]; /* ── PEQ catalog item type ── */ export type PeqCatalogItem = NonNullable[number]; /** 本地编辑缓存(按预设名称);syncPeq 拉取时优先于设备 catalog */ export type PeqPresetLocalCache = { filters?: PeqFilter[]; preamp?: number; autoPre?: number; }; /* ── Flat preset filters ── */ export const FLAT_PRESET_FILTERS: PeqFilter[] = [ { type: 4, fc: 80, gain: 0, q: 0.1 }, { type: 4, fc: 150, gain: 0, q: 0.1 }, { type: 4, fc: 350, gain: 0, q: 0.1 }, { type: 4, fc: 750, gain: 0, q: 0.1 }, { type: 4, fc: 1500, gain: 0, q: 0.1 }, { type: 4, fc: 3000, gain: 0, q: 0.1 }, { type: 4, fc: 6000, gain: 0, q: 0.1 }, { type: 4, fc: 10000, gain: 0, q: 0.1 }, { type: 4, fc: 14000, gain: 0, q: 0.1 }, { type: 4, fc: 18000, gain: 0, q: 0.1 }, ]; /* ── Catalog target type & data ── */ export type CatalogTarget = { name: string; bassBoost: { fc: number; q: number; gain: number }; ear: "in" | "over" | "all"; }; export const CATALOG_TARGETS: CatalogTarget[] = [ { name: "Harman over-ear 2018", bassBoost: { fc: 105, q: 0.7, gain: 6 }, ear: "over", }, { name: "HMS II.3 Harman over-ear 2018", bassBoost: { fc: 105, q: 0.7, gain: 6 }, ear: "over", }, { name: "crinacle EARS + 711 Harman over-ear 2018", bassBoost: { fc: 105, q: 0.7, gain: 6 }, ear: "over", }, { name: "Harman in-ear 2019", bassBoost: { fc: 105, q: 0.7, gain: 9.5 }, ear: "in", }, { name: "AutoEq in-ear", bassBoost: { fc: 105, q: 0.7, gain: 8 }, ear: "in", }, { name: "HMS II.3 AutoEq in-ear", bassBoost: { fc: 105, q: 0.7, gain: 8 }, ear: "in", }, { name: "HMS II.3 Harman in-ear 2019", bassBoost: { fc: 105, q: 0.7, gain: 9.5 }, ear: "in", }, { name: "Diffuse Field 5128 (-1 dB/oct)", bassBoost: { fc: 105, q: 0.7, gain: 0 }, ear: "over", }, { name: "LMG 5128 0.6 without bass", bassBoost: { fc: 105, q: 0.7, gain: 6 }, ear: "over", }, { name: "JM-1 with Harman filters", bassBoost: { fc: 105, q: 0.7, gain: 6.5 }, ear: "all", }, { name: "oratory1990 in-ear", bassBoost: { fc: 105, q: 0.7, gain: 9.5 }, ear: "in", }, { name: "oratory1990 over-ear", bassBoost: { fc: 105, q: 0.7, gain: 6 }, ear: "over", }, { name: "Harman over-ear 2013", bassBoost: { fc: 105, q: 0.7, gain: 6 }, ear: "over", }, { name: "Flat", bassBoost: { fc: 105, q: 0.7, gain: 0 }, ear: "all", }, ];