manage Route::_have_internal_generator more accurately and never flush processors...
[ardour.git] / libs / ardour / track.cc
index 79965befbe90f09c33981e018af7f2fd30fd0c59..44f84ca3dcb7163318ffa78239efe1528d1cbab5 100644 (file)
@@ -270,44 +270,21 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
 
        _diskstream->check_record_status (start_frame, can_record);
 
-       bool send_silence;
+       bool be_silent;
 
        if (_have_internal_generator) {
                /* since the instrument has no input streams,
                   there is no reason to send any signal
                   into the route.
                */
-               send_silence = true;
+               be_silent = true;
        } else {
-               if (!Config->get_tape_machine_mode()) {
-                       /*
-                          ADATs work in a strange way..
-                          they monitor input always when stopped.and auto-input is engaged.
-                       */
-                       if ((Config->get_monitoring_model() == SoftwareMonitoring)
-                                       && (_session.config.get_auto_input () || _diskstream->record_enabled())) {
-                               send_silence = false;
-                       } else {
-                               send_silence = true;
-                       }
-               } else {
-                       /*
-                          Other machines switch to input on stop if the track is record enabled,
-                          regardless of the auto input setting (auto input only changes the
-                          monitoring state when the transport is rolling)
-                       */
-                       if ((Config->get_monitoring_model() == SoftwareMonitoring)
-                                       && _diskstream->record_enabled()) {
-                               send_silence = false;
-                       } else {
-                               send_silence = true;
-                       }
-               }
+                be_silent = send_silence ();
        }
 
        _amp->apply_gain_automation(false);
 
-       if (send_silence) {
+       if (be_silent) {
 
                /* if we're sending silence, but we want the meters to show levels for the signal,
                   meter right here.
@@ -671,3 +648,65 @@ Track::adjust_capture_buffering ()
                 _diskstream->adjust_capture_buffering ();
         }
 }
+
+bool
+Track::send_silence () const
+{
+        /*
+          ADATs work in a strange way..
+          they monitor input always when stopped.and auto-input is engaged.
+
+          Other machines switch to input on stop if the track is record enabled,
+          regardless of the auto input setting (auto input only changes the
+          monitoring state when the transport is rolling)
+        */
+
+        bool send_silence;
+
+        if (!Config->get_tape_machine_mode()) {
+                /*
+                  ADATs work in a strange way..
+                  they monitor input always when stopped.and auto-input is engaged.
+                */
+                if ((Config->get_monitoring_model() == SoftwareMonitoring)
+                    && (_session.config.get_auto_input () || _diskstream->record_enabled())) {
+                        send_silence = false;
+                } else {
+                        send_silence = true;
+                }
+        } else {
+                /*
+                  Other machines switch to input on stop if the track is record enabled,
+                  regardless of the auto input setting (auto input only changes the
+                  monitoring state when the transport is rolling)
+                */
+                if ((Config->get_monitoring_model() == SoftwareMonitoring)
+                    && _diskstream->record_enabled()) {
+                        send_silence = false;
+                } else {
+                        send_silence = true;
+                }
+        }
+
+        return send_silence;
+}
+
+void
+Track::maybe_declick (BufferSet& bufs, framecnt_t nframes, int declick)
+{      
+        /* never declick if there is an internal generator - we just want it to 
+           keep generating sound without interruption.
+        */
+
+        if (_have_internal_generator) {
+                return;
+        }
+
+        if (!declick) {
+               declick = _pending_declick;
+       }
+
+       if (declick != 0) {
+               Amp::declick (bufs, nframes, declick);
+       }
+}