class SoundManager { constructor(soundSource) { this.soundSource = soundSource; this.sound = new Audio(this.soundSource); this.lastPlayed = 0; } play() { if (Date.now() - this.lastPlayed < 50) return; const node = this.sound.cloneNode(); node.play(); setTimeout(() => { node.remove(); }, this.sound.duration * 1000); this.lastPlayed = Date.now(); } }