Skip to main content

SoundResetOptions

The SoundResetOptions interface defines which aspects of a sound (or the entire sound manager) should be reset. Use it with the reset() or resetSound() methods to selectively reset specific properties.

export interface SoundResetOptions {
keepVolumes?: boolean;
keepPanning?: boolean;
keepSpatial?: boolean;
keepPlaybackRate?: boolean;
unloadSounds?: boolean;
}

Resetting a Single Sound

Use resetSound() to reset a specific sound with selective options:

const mySoundManager = new SoundManager();
await mySoundManager.loadSound('voice', '/audio/voice.mp3');

mySoundManager.play('voice', {
volume: 0.5,
pan: -0.8,
playbackRate: 1.5,
loop: true,
});

// Only reset the volume and pan, keep other settings
mySoundManager.resetSound('voice', {
keepVolumes: false,
keepPanning: false,
});

// The sound keeps playing with default volume (1.0) and center pan,
// but keeps its custom playback rate (1.5) and loop setting (true).
  • reset - Reset the entire sound manager
  • resetSound - Reset a specific sound
  • destroy - Completely destroy the sound manager