mirror of
https://github.com/danbulant/discord.js
synced 2026-07-10 21:50:59 +00:00
Defer some creations
This commit is contained in:
parent
91fc6ccb5c
commit
22a6ded341
1 changed files with 7 additions and 6 deletions
|
|
@ -168,15 +168,16 @@ class VoiceBroadcast extends EventEmitter {
|
||||||
|
|
||||||
buffer = this.applyVolume(buffer);
|
buffer = this.applyVolume(buffer);
|
||||||
|
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
for (const x of this.dispatchers.entries()) {
|
for (const x of this.dispatchers.entries()) {
|
||||||
const [volume, container] = x;
|
const [volume, container] = x;
|
||||||
if (container.size === 0) continue;
|
if (container.size === 0) continue;
|
||||||
setImmediate(() => {
|
|
||||||
const opusPacket = this.opusEncoder.encode(this.applyVolume(buffer, volume));
|
const opusPacket = this.opusEncoder.encode(this.applyVolume(buffer, volume));
|
||||||
for (const dispatcher of container.values()) {
|
for (const dispatcher of container.values()) {
|
||||||
dispatcher.process(buffer, true, opusPacket);
|
setTimeout(() => dispatcher.process(buffer, true, opusPacket), count);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue