DiskReader::_declick_amp needs to repeat the same work for each audio channel handled
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 19 Nov 2019 04:38:25 +0000 (21:38 -0700)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 19 Nov 2019 04:45:39 +0000 (21:45 -0700)
libs/ardour/disk_reader.cc

index 099ec72ba921b0a3cdb788a3a2ea68c42049750f..cc4748f7fb9df512b9ac8fecb7cb071cbbfc8888 100644 (file)
@@ -344,6 +344,8 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
                        scaling = 1.0;
                }
 
+               const float initial_declick_gain = _declick_amp.gain ();
+
                for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) {
 
                        ChannelInfo* chaninfo (*chan);
@@ -390,8 +392,17 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
 
                        }
 
+                       /* reset _declick_amp to the correct gain before
+                        * processing this channel.
+                        */
+
+                       _declick_amp.set_gain (initial_declick_gain);
                        _declick_amp.apply_gain (disk_buf, nframes, target_gain);
 
+                       /* _declick_amp is now left with the correct gain after
+                        * processing nframes
+                        */
+
                        Amp::apply_simple_gain (disk_buf, nframes, scaling);
 
                        if (ms & MonitoringInput) {