+ if (tgain != _current_gain) {
+
+ /* target gain has changed */
+
+ Amp::apply_gain (mixbufs, nframes, _current_gain, tgain);
+ _current_gain = tgain;
+
+ } else if (tgain == 0.0) {
+
+ /* we were quiet last time, and we're still supposed to be quiet.
+ */
+
+ _meter->reset ();
+ Amp::apply_simple_gain (mixbufs, nframes, 0.0);
+ goto out;
+
+ } else if (tgain != 1.0) {
+
+ /* target gain has not changed, but is not zero or unity */
+ Amp::apply_simple_gain (mixbufs, nframes, tgain);
+ }
+
+ _amp->set_gain_automation_buffer (_session.send_gain_automation_buffer ());
+ _amp->setup_gain_automation (start_frame, end_frame, nframes);
+ _amp->run (mixbufs, start_frame, end_frame, nframes, true);
+
+ /* consider metering */
+
+ if (_metering) {
+ if (_amp->gain_control()->get_value() == 0) {
+ _meter->reset();
+ } else {
+ _meter->run (mixbufs, start_frame, end_frame, nframes, true);