version>=2008 使用了新的重命名接口、EQ 排序功能
This commit is contained in:
@@ -240,6 +240,20 @@ export interface PeqApplyPayload {
|
||||
peqApply: PeqPresetBody;
|
||||
}
|
||||
|
||||
/** POST body for `/dev/info.cgi` — rename an existing PEQ preset. */
|
||||
export interface PeqRenamePayload {
|
||||
peqRename: {
|
||||
oldName: string;
|
||||
newName: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** POST body for `/dev/info.cgi` — reorder PEQ presets. */
|
||||
export interface PeqSoftPayload {
|
||||
peqSoft: string[];
|
||||
peqSelect: number;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Input/Output Labels
|
||||
// ============================================================
|
||||
@@ -383,6 +397,38 @@ export class LuxsinAPI {
|
||||
}
|
||||
}
|
||||
|
||||
/** Rename a headphone PEQ profile. */
|
||||
async renamePeq(oldName: string, newName: string): Promise<void> {
|
||||
const payload: PeqRenamePayload = { peqRename: { oldName, newName } };
|
||||
const encoded = encodeCustomBase64(JSON.stringify(payload));
|
||||
const form = new URLSearchParams();
|
||||
form.set("json", encoded);
|
||||
const response = await fetch(`${this.baseUrl}/dev/info.cgi`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" },
|
||||
body: form.toString(),
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(`PEQ rename failed: ${response.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
/** Reorder headphone PEQ profiles. */
|
||||
async sortPeq(names: string[], peqSelect: number): Promise<void> {
|
||||
const payload: PeqSoftPayload = { peqSoft: names, peqSelect };
|
||||
const encoded = encodeCustomBase64(JSON.stringify(payload));
|
||||
const form = new URLSearchParams();
|
||||
form.set("json", encoded);
|
||||
const response = await fetch(`${this.baseUrl}/dev/info.cgi`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" },
|
||||
body: form.toString(),
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(`PEQ sort failed: ${response.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
setVolume(volume: number) { return this.setSetting({ volume }); }
|
||||
setInput(input: number) { return this.setSetting({ input }); }
|
||||
setOutput(output: number) { return this.setSetting({ output }); }
|
||||
|
||||
Reference in New Issue
Block a user