新增氛围灯功能,对 EQ 名称长度做限制
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { getFilterType } from "@/lib/peqAudio";
|
||||
import { normalizePeqFiltersForSubmit, type PeqFilter, type PeqState } from "@/lib/luxsinApi";
|
||||
import type { EqBand } from "./types";
|
||||
import { clampPeqPresetName } from "./peqPresetName";
|
||||
|
||||
export function cloneBands(source: EqBand[]) {
|
||||
return source.map((band) => ({ ...band }));
|
||||
@@ -32,12 +33,13 @@ export function buildPeqCatalogSyncKey(
|
||||
}
|
||||
|
||||
export function getUniquePresetName(base: string, existingNames: string[]) {
|
||||
if (!existingNames.includes(base)) return base;
|
||||
const clippedBase = clampPeqPresetName(base);
|
||||
if (!existingNames.includes(clippedBase)) return clippedBase;
|
||||
let index = 1;
|
||||
while (existingNames.includes(`${base}_${index}`)) {
|
||||
while (existingNames.includes(clampPeqPresetName(`${clippedBase}_${index}`))) {
|
||||
index += 1;
|
||||
}
|
||||
return `${base}_${index}`;
|
||||
return clampPeqPresetName(`${clippedBase}_${index}`);
|
||||
}
|
||||
|
||||
/** UI band row → device `PeqFilter` (fc + numeric type), same as legacy `getFilterVal` mapping via `getFilterType`. */
|
||||
|
||||
Reference in New Issue
Block a user