Auto-monitor == Cue for MIDI tracks.
authorBen Loftis <ben@harrisonconsoles.com>
Thu, 15 Feb 2018 00:04:57 +0000 (18:04 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Thu, 15 Feb 2018 00:04:57 +0000 (18:04 -0600)
libs/ardour/ardour/audio_track.h
libs/ardour/ardour/midi_track.h
libs/ardour/ardour/route.h
libs/ardour/ardour/types.h
libs/ardour/audio_track.cc
libs/ardour/midi_track.cc
libs/ardour/route.cc

index aecf5d2c9f3e0bb881d31e38649543c107da3b89..ee25837481b24dc8eb547d86d997b6e7d70f210f 100644 (file)
@@ -36,6 +36,8 @@ class LIBARDOUR_API AudioTrack : public Track
        AudioTrack (Session&, std::string name, TrackMode m = Normal);
        ~AudioTrack ();
 
+       MonitorState get_auto_monitoring_state () const;
+
        void freeze_me (InterThreadInfo&);
        void unfreeze ();
 
index abee445e010ffd8df9fa012d108c32ab4146cd2d..d9a11540e4ae97ac33c8f944a0dd9431c75ace94 100644 (file)
@@ -125,6 +125,7 @@ public:
        boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const;
 
        MonitorState monitoring_state () const;
+       MonitorState get_auto_monitoring_state () const;
 
        MidiBuffer const& immediate_event_buffer () const { return _immediate_event_buffer; }
 
index 138f8a9d714ab54bf547cc9d0df3651eb7bbdce9..bfd894375be86804b65d0558cb9837e0e8c758ea 100644 (file)
@@ -134,6 +134,8 @@ public:
        boost::shared_ptr<MonitorControl> monitoring_control() const { return _monitoring_control; }
 
        MonitorState monitoring_state () const;
+       virtual MonitorState get_auto_monitoring_state () const { return MonitoringSilence; }
+
        virtual MeterState metering_state () const;
 
        /* these are the core of the API of a Route. see the protected sections as well */
index 352c20ae9bdf55dccc27b46f0c2a4fe04990f202..4bdab6b0707a5f42eff2585fc5a3131764220b9c 100644 (file)
@@ -432,6 +432,7 @@ namespace ARDOUR {
                MonitoringSilence = 0x1,
                MonitoringInput = 0x2,
                MonitoringDisk = 0x4,
+               MonitoringCue = 0x6,
        };
 
        enum MeterState {
index 12c2f1975b5c44a4b63cf7226e15ae7a9e549d1f..46aff98122db5735884493edde4a04867d6ef885 100644 (file)
@@ -64,6 +64,73 @@ AudioTrack::~AudioTrack ()
        }
 }
 
+MonitorState
+AudioTrack::get_auto_monitoring_state () const
+{
+       /* 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;
+}
+
 int
 AudioTrack::set_state (const XMLNode& node, int version)
 {
index a6a3b9f6f8b69268a99c80f3e77e463185a2afcd..798bd1aef5da6e5df83bfd63c1feba3c065f44d1 100644 (file)
@@ -826,6 +826,13 @@ MidiTrack::monitoring_state () const
        return ms;
 }
 
+MonitorState
+MidiTrack::get_auto_monitoring_state () const
+{
+       //if we are a midi track,  we ignore auto_input, tape_mode, etc etc.  "Auto" will monitor Disk+In
+       return MonitoringCue;
+}
+
 void
 MidiTrack::filter_input (BufferSet& bufs)
 {
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