mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 17:43:30 +01:00
Defer some creations
This commit is contained in:
@@ -168,15 +168,16 @@ class VoiceBroadcast extends EventEmitter {
|
||||
|
||||
buffer = this.applyVolume(buffer);
|
||||
|
||||
let count = 0;
|
||||
|
||||
for (const x of this.dispatchers.entries()) {
|
||||
const [volume, container] = x;
|
||||
if (container.size === 0) continue;
|
||||
setImmediate(() => {
|
||||
const opusPacket = this.opusEncoder.encode(this.applyVolume(buffer, volume));
|
||||
for (const dispatcher of container.values()) {
|
||||
dispatcher.process(buffer, true, opusPacket);
|
||||
}
|
||||
});
|
||||
const opusPacket = this.opusEncoder.encode(this.applyVolume(buffer, volume));
|
||||
for (const dispatcher of container.values()) {
|
||||
setTimeout(() => dispatcher.process(buffer, true, opusPacket), count);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user