useSound
Returns a soundboard for semantic game events.
import { useSound } from 'filedom/sound';
const sfx = useSound();
const handleMerge = () => sfx.play('merge');
Parameters
useSound<E extends string = SoundEvent>(
scheme?: SoundScheme<E>,
backend?: SoundBackend
)
scheme: maps each event to a sound. Defaults to KENNEY_SCHEME, the bundled sample set. An event mapped to null plays nothing. The latest scheme is used on every call.
backend: playback backend. Defaults to the shared native audio backend.
Returns
Soundboard<E> with play(event, options?). The only option is volume, a linear gain where 1 is normal. play keeps the same identity across renders unless backend changes, so it is safe in effect dependencies. Playback does nothing while muted.