1
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import { boolValue, clamp, numberValue, type ParameterSnapshot } from '../parameterState'
|
||||
export const defaults = { speakerVolume: 50, speakerSleepMode: false }
|
||||
export const labels = { volume: '音箱音量', speaker_sleep_mode: '音箱睡眠模式' }
|
||||
export function sync(state: typeof defaults, controls: ParameterSnapshot) {
|
||||
const volume = numberValue(controls.volume?.attributes?.volume_level)
|
||||
if (controls.volume?.available && volume !== undefined) state.speakerVolume = clamp(Math.round(volume * 100), 0, 100)
|
||||
const sleep = boolValue(controls.speaker_sleep_mode)
|
||||
if (sleep !== undefined) state.speakerSleepMode = sleep
|
||||
}
|
||||
Reference in New Issue
Block a user