Add Shift+C microphone input calibration
This commit is contained in:
@@ -37,6 +37,7 @@ export class AudioEngine {
|
||||
|
||||
private outboundSource: MediaStreamAudioSourceNode | null = null;
|
||||
private outboundInputGain: GainNode | null = null;
|
||||
private outboundInputGainValue = 1;
|
||||
private outboundDestination: MediaStreamAudioDestinationNode | null = null;
|
||||
private outboundEffectRuntime: EffectRuntime | null = null;
|
||||
private loopbackEnabled = false;
|
||||
@@ -97,6 +98,7 @@ export class AudioEngine {
|
||||
if (!this.outboundInputGain) {
|
||||
this.outboundInputGain = this.audioCtx.createGain();
|
||||
}
|
||||
this.outboundInputGain.gain.value = this.outboundInputGainValue;
|
||||
if (!this.outboundDestination) {
|
||||
this.outboundDestination = this.audioCtx.createMediaStreamDestination();
|
||||
}
|
||||
@@ -183,6 +185,19 @@ export class AudioEngine {
|
||||
return this.voiceLayerEnabled;
|
||||
}
|
||||
|
||||
setOutboundInputGain(value: number): number {
|
||||
const next = Math.max(0.01, Number.isFinite(value) ? value : 1);
|
||||
this.outboundInputGainValue = next;
|
||||
if (this.outboundInputGain && this.audioCtx) {
|
||||
this.outboundInputGain.gain.setValueAtTime(next, this.audioCtx.currentTime);
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
getOutboundInputGain(): number {
|
||||
return this.outboundInputGainValue;
|
||||
}
|
||||
|
||||
toggleLoopback(): boolean {
|
||||
this.loopbackEnabled = !this.loopbackEnabled;
|
||||
this.rebuildOutboundEffectGraph();
|
||||
|
||||
Reference in New Issue
Block a user