From e443719bed6e05ce0e875f877f686c4f22c6f4b2 Mon Sep 17 00:00:00 2001 From: Marks Polakovs Date: Sun, 10 May 2020 13:10:13 +0200 Subject: [PATCH] use decibels for mic calibration slider --- src/mixer/audio.ts | 5 ++++- src/mixer/state.ts | 2 +- src/optionsMenu/MicTab.tsx | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mixer/audio.ts b/src/mixer/audio.ts index b9105de..93088ee 100644 --- a/src/mixer/audio.ts +++ b/src/mixer/audio.ts @@ -286,7 +286,10 @@ export class AudioEngine extends ((EngineEmitter as unknown) as { } setMicCalibrationGain(value: number) { - this.micCalibrationGain.gain.value = value; + this.micCalibrationGain.gain.value = + value === 0 + ? 1 : + Math.pow(10, (value / 10)); } setMicVolume(value: number) { diff --git a/src/mixer/state.ts b/src/mixer/state.ts index 973b0f6..8a29ff3 100644 --- a/src/mixer/state.ts +++ b/src/mixer/state.ts @@ -83,7 +83,7 @@ const mixerState = createSlice({ open: false, volume: 1, gain: 1, - baseGain: 1, + baseGain: 0, openError: null, id: "None", }, diff --git a/src/optionsMenu/MicTab.tsx b/src/optionsMenu/MicTab.tsx index 4e213ea..8987a59 100644 --- a/src/optionsMenu/MicTab.tsx +++ b/src/optionsMenu/MicTab.tsx @@ -124,9 +124,9 @@ export function MicTab() {
dispatch(MixerState.setMicBaseGain(parseFloat(e.target.value)))