fix: 音效垃圾清理

This commit is contained in:
AncTe committed 2025-03-17 23:49:01 +08:00
1 parent 0a9457caf4
commit 704a23254a
2 files changed
+3 -1

No files matched your search

@@ -93,8 +93,10 @@ export class SoundPlayer<
route.addEffect([stereo, this.gain]);
this.player.addRoute(`sounds.${soundNum}`, route);
route.play();
// 清理垃圾
source.output.addEventListener('ended', () => {
this.playing.delete(soundNum);
this.player.removeRoute(`sounds.${soundNum}`);
});
this.playing.add(soundNum);
return soundNum;
@@ -146,7 +146,7 @@ export class AudioStreamSource extends AudioSource implements IStreamReader {
logger.error(
25,
[...toCheck]
.map(v => v.toString().padStart(2, '0'))
.map(v => v.toString(16).padStart(2, '0'))
.join(' ')
.toUpperCase()
);