the held duck attenuation, 1 when full
Ducks the music under dialogue or a menu: the current track glides to
volume * level over fadeDuration and stays there until unduck, and tracks
started while ducked start ducked. Pending fades are retargeted proportionally, so
ducking mid-crossfade still lands quiet. Sound is untouched. Idempotent.
0 (silent) to 1 (full); clamped, 0.5 by default
seconds; 0 switches immediately with no crossfade
Plays the supplied sequence repeatedly. This is deliberately small and backend-agnostic:
callers can repeat entries to weight a track, while HTMLAudioElement's optional onended
advances the queue when available.
The counterpart to suspend: restarts the current track where it paused. A track
stopped (not suspended) while hidden stays stopped - resume only resumes.
Silences everything for a page hide: pauses the current track and every fading one,
and freezes update until resume, so a crossfade mid-flight continues where it
stopped rather than finishing inaudibly in a background tab. Idempotent.
releases a duck back to full volume through the same fade path
Background music with crossfade: switching tracks fades the old one out and the new one in over the same span, rather than cutting straight from one to the other. Like
AnimatedSprite, nothing advances on its own - callupdate(dt)from the scene.Example