TASK 8 meter scaling: +10 dB input amplification in AudioLevelMeter.ToDisplay so the meters use the full bar — speech peaks (~0.2 RMS, -14 dBFS) read ~0.93 (red zone) and normal speech (~0.05, -26 dBFS) ~0.73 (yellow) at maxed volume, instead of hovering at the red edge; ≤0.001 linear still reads zero so the meter never idles on background noise; one knob shared by the mic bar and the game bar (× MicVolume gain-on-noise untouched); tests updated + new ToDisplay_Pushes_Speech_Peaks_Into_Red_At_Maxed_Volume — 171 tests passing, 0 warnings

This commit is contained in:
2026-08-14 08:43:06 -07:00
parent d90b5ded0d
commit 0b71b030e4
7 changed files with 53 additions and 12 deletions
+15 -4
View File
@@ -331,11 +331,22 @@ public class AudioLevelMeterTests
Assert.Equal(0f, AudioLevelMeter.ToDisplay(0f));
Assert.Equal(0f, AudioLevelMeter.ToDisplay(0.001f), 2);
// -60 dBFS floor → 0, 0 dBFS → 1, and a decade (~-20 dB) is 1/3 up the bar.
// -60 dBFS floor → 0, 0 dBFS → 1, and +10 dB amplification: a decade
// (~-20 dB) is 2/3 up the bar.
Assert.Equal(1f, AudioLevelMeter.ToDisplay(1f), 3);
Assert.Equal(0.5f, AudioLevelMeter.ToDisplay(0.0316f), 2);
Assert.InRange(AudioLevelMeter.ToDisplay(0.1f), 0.66f, 0.67f);
Assert.InRange(AudioLevelMeter.ToDisplay(0.01f), 0.32f, 0.34f);
Assert.InRange(AudioLevelMeter.ToDisplay(0.0316f), 0.66f, 0.67f);
Assert.InRange(AudioLevelMeter.ToDisplay(0.1f), 0.83f, 0.84f);
Assert.InRange(AudioLevelMeter.ToDisplay(0.01f), 0.49f, 0.51f);
}
[Fact]
public void ToDisplay_Pushes_Speech_Peaks_Into_Red_At_Maxed_Volume()
{
// ~0.2 linear RMS (-14 dBFS) is a loud speech peak; at maxed volume it
// must land in the red zone (0.8+) and normal speech (~0.05, -26 dBFS)
// in the yellow — the meter uses the whole bar proportionately.
Assert.InRange(AudioLevelMeter.ToDisplay(0.2f), 0.92f, 0.95f);
Assert.InRange(AudioLevelMeter.ToDisplay(0.05f), 0.72f, 0.75f);
}
[Fact]