fix: 音效垃圾清理

This commit is contained in:
unanmed 2025-03-17 23:49:01 +08:00
parent 0a9457caf4
commit 704a23254a
2 changed files with 3 additions and 1 deletions

View File

@ -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;

View File

@ -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()
);