fix mic meter and distribute participant positions
Build and Publish / Metadata (push) Successful in 1s
Build and Publish / BuildAndDeployAmd64 (push) Failing after 10m18s

This commit is contained in:
mats committed 2026-09-22 17:24:34 +02:00
1 parent 7b9ff4c098
commit 2888a54259
2 files changed
+23 -25

No files matched your search

+7 -2
View File
@@ -6,6 +6,7 @@ export class AudioManager {
this.source = null;
this.gainNode = null;
this.analyser = null;
this.meterSink = null;
this.meterData = new Float32Array(1024);
this.gain = Number(localStorage.getItem('voicepoc.micGain') || 1);
}
@@ -25,20 +26,24 @@ export class AudioManager {
this.gainNode.gain.value = this.gain;
this.analyser = this.context.createAnalyser();
this.analyser.fftSize = 1024;
this.meterSink = this.context.createGain();
this.meterSink.gain.value = 0;
const destination = this.context.createMediaStreamDestination();
this.source.connect(this.gainNode).connect(this.analyser);
// Keep the analyser alive without sending the microphone to the speakers.
this.analyser.connect(this.meterSink).connect(this.context.destination);
this.gainNode.connect(destination);
this.outputStream = destination.stream;
return this.outputStream;
}
detachInput() {
for (const node of [this.source, this.gainNode, this.analyser]) {
for (const node of [this.source, this.gainNode, this.analyser, this.meterSink]) {
try { node?.disconnect(); } catch {}
}
this.outputStream?.getTracks().forEach((track) => track.stop());
this.rawStream?.getTracks().forEach((track) => track.stop());
this.source = this.gainNode = this.analyser = null;
this.source = this.gainNode = this.analyser = this.meterSink = null;
this.outputStream = this.rawStream = null;
}