]> git.sesse.net Git - nageru/commitdiff
Change the auto-gain stopping criterion to be on corrected LU.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 22 Oct 2016 11:36:26 +0000 (13:36 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 25 Oct 2016 16:48:36 +0000 (18:48 +0200)
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.

audio_mixer.cpp

index 13532e20a4d506d0fd39b0b46e144599d2b53374..e4d4cff4b86222e41d6b0d8181b8d519a1f1b6a1 100644 (file)
@@ -583,13 +583,12 @@ vector<float> 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