x9适配
This commit is contained in:
@@ -103,6 +103,13 @@ export interface DeviceState {
|
||||
subwoofer_value: number;
|
||||
subwoofer_rate: number;
|
||||
subwoofer_gain: number;
|
||||
subwoofer_mix_type: number;
|
||||
subwoofer_delay: number;
|
||||
subwoofer_delay_main: number;
|
||||
subwoofer_delay_r: number;
|
||||
subwoofer_delay_main_r: number;
|
||||
subwoofer_lpf_enable: number;
|
||||
subwoofer_hpf_enable: number;
|
||||
loudness_enable: number;
|
||||
loudness_bass_gain: number;
|
||||
loudness_treble_gain: number;
|
||||
@@ -163,6 +170,9 @@ export interface PeqApplyPayload {
|
||||
// ============================================================
|
||||
export const INPUT_LABELS = ["USB", "USB-C", "Coaxial", "Optical", "Bluetooth", "IIS", "RCA"];
|
||||
export const OUTPUT_LABELS = ["XLR", "RCA", "Headset", "XLR/RCA"];
|
||||
|
||||
/** Device `output` index for headphone / headset. */
|
||||
export const OUTPUT_HEADSET_INDEX = 2;
|
||||
export const LANGUAGE_LABELS = ["English", "繁體中文", "简体中文"];
|
||||
export const SCREEN_LIGHT_LABELS = ["Bright", "Medium", "Dark"];
|
||||
export const KNOB_LIGHT_LABELS = ["Off", "Bright", "Medium", "Dark"];
|
||||
@@ -213,7 +223,9 @@ export class LuxsinAPI {
|
||||
const response = await fetch(`${this.baseUrl}/dev/info.cgi?action=syncData`);
|
||||
const text = await response.text();
|
||||
const decoded = decodeCustomBase64(text.trim());
|
||||
return JSON.parse(decoded) as DeviceState;
|
||||
const state = JSON.parse(decoded) as DeviceState;
|
||||
console.log("[syncData] decoded", state);
|
||||
return state;
|
||||
} catch (error) {
|
||||
this.maybeRedirectForHttpsCert(error);
|
||||
throw error;
|
||||
@@ -333,6 +345,20 @@ export function parseFirmwareVersion(version: unknown): number {
|
||||
return Number(parts[parts.length - 1]);
|
||||
}
|
||||
|
||||
/** Pre-out volume passthrough mode selected (0dB or -12dB). */
|
||||
export function isVolumePassthroughActive(dacVolumeDirect: number | undefined): boolean {
|
||||
return dacVolumeDirect === 1 || dacVolumeDirect === 2;
|
||||
}
|
||||
|
||||
/** Lock home volume controls when passthrough is on, except output is headphone. */
|
||||
export function isHomeVolumeLockedByPassthrough(
|
||||
dacVolumeDirect: number | undefined,
|
||||
output: number | undefined,
|
||||
): boolean {
|
||||
if (!isVolumePassthroughActive(dacVolumeDirect)) return false;
|
||||
return (output ?? -1) !== OUTPUT_HEADSET_INDEX;
|
||||
}
|
||||
|
||||
/** Max `bootSound` index available for the current firmware. */
|
||||
export function getBootSoundMaxIndex(firmwareVersion: number): number {
|
||||
return firmwareVersion >= 26 ? 10 : 6;
|
||||
@@ -401,6 +427,13 @@ export const MOCK_DEVICE_STATE: DeviceState = {
|
||||
subwoofer_value: 80,
|
||||
subwoofer_rate: 0,
|
||||
subwoofer_gain: 0,
|
||||
subwoofer_mix_type: 0,
|
||||
subwoofer_delay: 582,
|
||||
subwoofer_delay_main: 571,
|
||||
subwoofer_delay_r: 582,
|
||||
subwoofer_delay_main_r: 571,
|
||||
subwoofer_lpf_enable: 0,
|
||||
subwoofer_hpf_enable: 0,
|
||||
loudness_enable: 0,
|
||||
loudness_bass_gain: 3,
|
||||
loudness_treble_gain: 2,
|
||||
|
||||
Reference in New Issue
Block a user