From: Steinar H. Gunderson Date: Sat, 22 Oct 2016 11:36:26 +0000 (+0200) Subject: Change the auto-gain stopping criterion to be on corrected LU. X-Git-Tag: 1.4.0~13 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=aa96a4a558b36b1b2aaeaf34ddce33dc09622b28 Change the auto-gain stopping criterion to be on corrected LU. This might be less safe (there might be some feedback effects involved), but the behavior of working on _uncorrected_ LU was simply too unintuitive; it was hard to understand why the setting wasn't moving. --- diff --git a/audio_mixer.cpp b/audio_mixer.cpp index 13532e2..e4d4cff 100644 --- a/audio_mixer.cpp +++ b/audio_mixer.cpp @@ -583,13 +583,12 @@ vector AudioMixer::get_output(double pts, unsigned num_samples, Resamplin // (half-time of 30 seconds). double target_loudness_factor, alpha; double loudness_lu = r128.loudness_M() - ref_level_lufs; - double current_makeup_lu = to_db(final_makeup_gain); target_loudness_factor = final_makeup_gain * from_db(-loudness_lu); - // If we're outside +/- 5 LU uncorrected, we don't count it as + // If we're outside +/- 5 LU (after correction), we don't count it as // a normal signal (probably silence) and don't change the // correction factor; just apply what we already have. - if (fabs(loudness_lu - current_makeup_lu) >= 5.0 || !final_makeup_gain_auto) { + if (fabs(loudness_lu) >= 5.0 || !final_makeup_gain_auto) { alpha = 0.0; } else { // Formula adapted from