Auto-monitor == Cue for MIDI tracks.
[ardour.git] / libs / ardour / route.cc
index 2c3c14c94035e230b5d724525abe28b6b6232d89..3b615c517b1a00c12e6d31e65db259b0e0fa69ce 100644 (file)
@@ -57,6 +57,7 @@
 #include "ardour/delayline.h"
 #include "ardour/midi_buffer.h"
 #include "ardour/midi_port.h"
+#include "ardour/midi_track.h"
 #include "ardour/monitor_control.h"
 #include "ardour/monitor_processor.h"
 #include "ardour/pannable.h"
@@ -6007,67 +6008,6 @@ Route::monitoring_state () const
                        break;
        }
 
-       /* This is an implementation of the truth table in doc/monitor_modes.pdf;
-          I don't think it's ever going to be too pretty too look at.
-       */
-
-       bool const roll = _session.transport_rolling ();
-       bool const track_rec = _disk_writer->record_enabled ();
-       bool const auto_input = _session.config.get_auto_input ();
-       bool const software_monitor = Config->get_monitoring_model() == SoftwareMonitoring;
-       bool const tape_machine_mode = Config->get_tape_machine_mode ();
-       bool session_rec;
-
-       /* I suspect that just use actively_recording() is good enough all the
-        * time, but just to keep the semantics the same as they were before
-        * sept 26th 2012, we differentiate between the cases where punch is
-        * enabled and those where it is not.
-        *
-        * rg: sept 30 2017: Above is not the case: punch-in/out location is
-        * global session playhead position.
-        * When this method is called from process_output_buffers() we need
-        * to use delay-compensated route's process-position.
-        *
-        * NB. Disk reader/writer may also be offset by a same amount of time.
-        *
-        * Also keep in mind that _session.transport_rolling() is false during
-        * pre-roll but the disk already produces output.
-        *
-        * TODO: FIXME
-        */
-
-       if (_session.config.get_punch_in() || _session.config.get_punch_out()) {
-               session_rec = _session.actively_recording ();
-       } else {
-               session_rec = _session.get_record_enabled();
-       }
-
-       if (track_rec) {
-
-               if (!session_rec && roll && auto_input) {
-                       return MonitoringDisk;
-               } else {
-                       return software_monitor ? MonitoringInput : MonitoringSilence;
-               }
-
-       } else {
-
-               if (tape_machine_mode) {
-
-                       return MonitoringDisk;
-
-               } else {
-
-                       if (!roll && auto_input) {
-                               return software_monitor ? MonitoringInput : MonitoringSilence;
-                       } else {
-                               return MonitoringDisk;
-                       }
-
-               }
-       }
-
-       abort(); /* NOTREACHED */
-       return MonitoringSilence;
+       return get_auto_monitoring_state();
 }
 #endif