拆分 EQPage 页面,新增分享码功能,修复 bug,优化性能
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { getFilterType } from "@/lib/peqAudio";
|
||||
import type { PeqFilter, PeqState } from "@/lib/luxsinApi";
|
||||
import { normalizePeqFiltersForSubmit, type PeqFilter, type PeqState } from "@/lib/luxsinApi";
|
||||
import type { EqBand } from "./types";
|
||||
|
||||
export function cloneBands(source: EqBand[]) {
|
||||
@@ -54,3 +54,15 @@ export function bandToPeqFilter(b: {
|
||||
type: getFilterType(b.type),
|
||||
};
|
||||
}
|
||||
|
||||
export function importedFiltersToPeqFilters(filters: unknown): PeqFilter[] {
|
||||
return normalizePeqFiltersForSubmit(filters).map((f) => {
|
||||
const item = f as unknown as Record<string, unknown>;
|
||||
return {
|
||||
fc: Number(item.fc ?? item.freq ?? item.frequency ?? 1000),
|
||||
gain: Number(item.gain ?? 0),
|
||||
q: Number(item.q ?? 1),
|
||||
type: getFilterType(item.type as string | number),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user