mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-31 23:29:27 +08:00
优化
This commit is contained in:
parent
6a251f7e71
commit
abdcecc75e
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user