useSpeechOutputVoicing (composables/use-speech-output-voicing.ts)

airi · apps/stage-tamagotchi/src/renderer/composables/use-speech-output-voicing.ts · typescript · MIT
voice

Vue composable that tracks speech output voicing state across windows via event bus.

// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
import { defineInvoke } from '@moeru/eventa'
import { getSpeechBusContext, speechOutputGetPlaybackState, speechOutputPlaybackStateChangedEvent } from '@proj-airi/stage-ui/services/speech/bus'
import { onScopeDispose, shallowRef } from 'vue'

/**
 * Follows `voicing` of the speech output, which plays in the main window, from
 * another window of the app.
 *
 * The first value comes from a request to the output host, and later values
 * from its change events. The subscription ends with the calling scope.
 *
 * @returns
 * - `voicing`: the last state that the output host reported. It is `false`
 *   before the first report.
 * - `init

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key