This commit is contained in:
unanmed 2023-06-15 16:50:06 +08:00
parent 6a251f7e71
commit abdcecc75e

View File

@ -23,6 +23,7 @@ export class SoundEffect extends AudioPlayer {
const index = this.playMap.get(node); const index = this.playMap.get(node);
if (!index) return; if (!index) return;
delete this.playing[index]; delete this.playing[index];
this.playMap.delete(node);
}); });
this.on('update', () => { this.on('update', () => {
this.initAudio(this.stereo); this.initAudio(this.stereo);
@ -39,6 +40,8 @@ export class SoundEffect extends AudioPlayer {
const channel = this.buffer?.numberOfChannels; const channel = this.buffer?.numberOfChannels;
const ac = AudioPlayer.ac; const ac = AudioPlayer.ac;
if (!channel) return; if (!channel) return;
this.panner = null;
this.merger = null;
if (stereo) { if (stereo) {
this.panner = ac.createPanner(); this.panner = ac.createPanner();
this.panner.connect(this.gain); this.panner.connect(this.gain);
@ -80,6 +83,7 @@ export class SoundEffect extends AudioPlayer {
v.stop(); v.stop();
}); });
this.playing = {}; this.playing = {};
this.playMap.clear();
this._stopingAll = false; this._stopingAll = false;
} }