MCPcopy Create free account
hub / github.com/anomalyco/opencode / getAudio

Function getAudio

packages/tui/src/audio.ts:7–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5const sounds = new Map<string, Promise<AudioSound | null>>()
6
7function getAudio() {
8 if (audio !== undefined) return audio
9 try {
10 const next = Audio.create({ autoStart: false })
11 next.on("error", (error: Error, context: AudioErrorContext) => {
12 console.debug("tui audio error", { error, context })
13 })
14 audio = next
15 return next
16 } catch (error) {
17 console.debug("failed to create tui audio", { error })
18 audio = null
19 return null
20 }
21}
22
23export function loadSoundFile(file: string) {
24 const current = getAudio()

Callers 2

loadSoundFileFunction · 0.85
playFunction · 0.85

Calls 2

onMethod · 0.80
createMethod · 0.65

Tested by

no test coverage detected