'use client'; import { useCallback, useEffect, useRef } from 'react'; export interface SoundEffectOptions { /** 0..1 master volume. @default 1 */ volume?: number; /** Set to true to skip play() entirely (e.g. user-prefs gating). @default false */ silenced?: boolean; } export interface SoundEffectApi { /** Trigger playback. Fire-and-forget; cancel-safe. */ play: () => void; /** Eagerly preload the asset. */ preload: () => void; } /** * One-shot single-asset hook — the minimal "play a ding" helper. * * Lower level than `useNotificationSounds` (no persisted mute, no * per-event toggles). Use when you have ONE asset, ONE trigger, and * don't need cross-component sync. * * @example * ```tsx * const submitDing = useSoundEffect('/sfx/ding.mp3'); *