/** * Configuration options for creating a new Sound instance. * @example * ```typescript * const sound = new Sound({ * src: ['sound.mp3', 'sound.ogg'], * volume: 0.5, * autoplay: true, * onload: () => console.log('Voice loaded') * }); * ``` */ export interface SoundOptions { /** Source file(s) for the audio. Can be a string or array of strings for multiple formats. */ src: string | string[]; /** Automatically start playback when ready. Default: `false` */ autoplay?: boolean; /** Format(s) of the audio file(s). If not specified, will be extracted from the src URL. */ format?: string | string[]; /** Force HTML5 Audio. This should be used for large audio files so that you don't have to wait for the full file to be downloaded and decoded before playing. Default: `false` */ html5?: boolean; /** Set to true to mute the sound. Default: `false` */ mute?: boolean; /** Set to true to automatically loop the sound. Default: `false` */ loop?: boolean; /** The size of the inactive sounds pool. Default: `5` */ pool?: number; /** Automatically begin downloading the audio file when the Sound is initialized. If using HTML5 Audio, you can set this to 'metadata' to only preload the metadata. Default: `true` */ preload?: boolean | "metadata"; /** The rate of playback. 0.5 to 4.0, with 1.0 being normal speed. Default: `1.0` */ rate?: number; /** Define a sprite map of sections within the audio file. */ sprite?: Record; /** The volume of the sound, from 0.0 to 1.0. Default: `1.0` */ volume?: number; /** * Send credentials (cookies, TLS client certificates) with the request. * @deprecated since 20.4.0, use `xhr: { withCredentials }` */ xhrWithCredentials?: boolean; /** Configure fetch options for loading audio files (when using Web Audio). */ xhr?: { /** The HTTP method to use. Default: `'GET'` */ method?: string; /** Custom headers to send with the request. */ headers?: Record; /** Whether to send credentials with the request. Default: `false` */ withCredentials?: boolean; }; /** Fires when the sound finishes playing. */ onend?: () => void; /** Fires when the sound has been faded in/out. */ onfade?: () => void; /** Fires when the sound has been loaded. */ onload?: () => void; /** Fires when the sound is unable to load. */ /** * Called when the clip fails to load. `id` is the voice that failed, or * `null` when the failure belongs to the clip as a whole (decode failure, * no codec, no audio support). */ onloaderror?: (id: number | null, msg: string) => void; /** Fires when the sound is unable to play. */ onplayerror?: (id: number, msg: string) => void; /** Fires when the sound has been paused. */ onpause?: () => void; /** Fires when the sound begins playing. */ onplay?: () => void; /** Fires when the sound has been stopped. */ onstop?: () => void; /** Fires when the sound has been muted/unmuted. */ onmute?: () => void; /** Fires when the sound's volume has changed. */ onvolume?: () => void; /** Fires when the sound's playback rate has changed. */ onrate?: () => void; /** Fires when the sound's current position has changed. */ onseek?: () => void; /** Fires when the audio has been unlocked (required for some browsers on mobile). */ onunlock?: () => void; } /** * Type guard to check if a node is an HTMLAudioElement. * This specifically excludes HTMLVideoElement by checking for the absence of videoWidth. * @param node - The node to check * @returns True if the node is an HTMLAudioElement * @example * ```typescript * if (isHTMLAudioElement(node)) { * node.volume = 0.5; * } * ``` */ export declare function isHTMLAudioElement(node: HTMLAudioElementWithUnlocked | GainNodeWithBufferSource | null): node is HTMLAudioElementWithUnlocked; /** * Type guard to check if a node is a GainNode. * @param node - The node to check * @returns True if the node is a GainNode * @example * ```typescript * if (isGainNode(node)) { * node.gain.value = 0.5; * } * ``` */ export declare function isGainNode(node: HTMLAudioElementWithUnlocked | GainNodeWithBufferSource | null): node is GainNodeWithBufferSource; //# sourceMappingURL=types.d.ts.map