diff --git a/src/mixer/audio.ts b/src/mixer/audio.ts index 0344867..df0615f 100644 --- a/src/mixer/audio.ts +++ b/src/mixer/audio.ts @@ -77,7 +77,7 @@ class Player extends ((PlayerEmitter as unknown) as { new (): EventEmitter }) { _applyVolume() { const level = this.volume + this.trim; - const linear = Math.pow(10, level / 10); + const linear = Math.pow(10, level / 20); if (linear < 1) { this.wavesurfer.setVolume(linear); (this.wavesurfer as any).backend.gainNode.gain.value = 1; @@ -312,7 +312,7 @@ export class AudioEngine extends ((EngineEmitter as unknown) as { setMicCalibrationGain(value: number) { this.micCalibrationGain.gain.value = - value === 0 ? 1 : Math.pow(10, value / 10); + value === 0 ? 1 : Math.pow(10, value / 20); } setMicVolume(value: number) { diff --git a/src/mixer/state.ts b/src/mixer/state.ts index 362c55e..8a0ca15 100644 --- a/src/mixer/state.ts +++ b/src/mixer/state.ts @@ -28,6 +28,8 @@ type VolumePresetEnum = "off" | "bed" | "full"; type MicVolumePresetEnum = "off" | "full"; export type MicErrorEnum = "NO_PERMISSION" | "NOT_SECURE_CONTEXT" | "UNKNOWN"; +const defaultTrimDB = -6; // The default trim applied to channel players. + interface PlayerState { loadedItem: PlanItem | Track | AuxItem | null; loading: number; @@ -64,7 +66,7 @@ const BasePlayerState: PlayerState = { state: "stopped", volume: 1, gain: 0, - trim: -3, + trim: defaultTrimDB, timeCurrent: 0, timeRemaining: 0, timeLength: 0, @@ -105,7 +107,7 @@ const mixerState = createSlice({ state.players[action.payload.player].tracklistItemID = -1; state.players[action.payload.player].loadError = false; if (action.payload.resetTrim) { - state.players[action.payload.player].trim = -3; + state.players[action.payload.player].trim = defaultTrimDB; } }, itemLoadPercentage( diff --git a/src/optionsMenu/helpers/VUMeter.tsx b/src/optionsMenu/helpers/VUMeter.tsx index 54a78e6..5e94074 100644 --- a/src/optionsMenu/helpers/VUMeter.tsx +++ b/src/optionsMenu/helpers/VUMeter.tsx @@ -87,7 +87,8 @@ export function VUMeter(props: VUMeterProps) { ctx.fillStyle = "#e8d120"; } - const valueOffset = Math.abs(peak - props.range[0]) / valueRange; + const valueOffset = + (Math.max(peak, props.range[0]) - props.range[0]) / valueRange; ctx.fillRect(0, 0, valueOffset * width, height - 10); diff --git a/src/showplanner/index.tsx b/src/showplanner/index.tsx index e016721..bacb975 100644 --- a/src/showplanner/index.tsx +++ b/src/showplanner/index.tsx @@ -145,7 +145,13 @@ function MicControl() {
)}