index ↓
audio
client.audioVolume, mute, speech, and short sounds on the device. setVolume and setMute set the output
level, onVolumeChanged reports every change, and tts speaks text.
commands
fire-and-forget. the promise resolves once the daemon has taken the message
volumeUp(): Promise<void>
await client.audio.volumeUp();volumeDown(): Promise<void>
await client.audio.volumeDown();muteToggle(): Promise<void>
await client.audio.muteToggle();ttsCancelAll(): Promise<void>
await client.audio.ttsCancelAll();events
the daemon pushes these unprompted. subscribing returns an unsubscribe function
onTtsStarted(handler: (TtsStarted) => void): () => void
const off = client.audio.onTtsStarted((ttsStarted) => {
console.log(ttsStarted.id);
});
// call off() to unsubscribeonTtsEnded(handler: (TtsEnded) => void): () => void
const off = client.audio.onTtsEnded((ttsEnded) => {
console.log(ttsEnded.id);
});
// call off() to unsubscribeonVolumeChanged(handler: (VolumeChanged) => void): () => void
const off = client.audio.onVolumeChanged((volumeChanged) => {
console.log(volumeChanged.level);
});
// call off() to unsubscribeonErrorEvent(handler: (AudioErrorReply) => void): () => void
const off = client.audio.onErrorEvent((reply) => {
console.log(reply.error);
});
// call off() to unsubscribetypes
shapes referenced above, as the sdk types them
type TtsStarted = {
id: string;
};type TtsEnded = {
id: string;
completed: boolean;
};type VolumeChanged = {
level: number;
muted: boolean;
};type AudioErrorReply = {
error: AudioError;
};type SetVolume = {
level: number;
};type SetMute = {
muted: boolean;
};type Tts = {
id: string;
text: string;
voice?: string;
};type TtsCancel = {
id: string;
};type Earcon = {
name: string;
};type AudioError = 'actionRejected' | 'ttsFailed' | 'unavailable' | 'noTarget';