correctly track monitoring changes in libardour and the GUI; required removing propag...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 21 Oct 2011 15:05:33 +0000 (15:05 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 21 Oct 2011 15:05:33 +0000 (15:05 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10265 d708f5d6-7413-0410-9779-e7cbd77b26cf

20 files changed:
gtk2_ardour/ardour3_styles.rc.in
gtk2_ardour/route_ui.cc
libs/ardour/ardour/audio_diskstream.h
libs/ardour/ardour/audio_track.h
libs/ardour/ardour/diskstream.h
libs/ardour/ardour/graph.h
libs/ardour/ardour/midi_diskstream.h
libs/ardour/ardour/midi_track.h
libs/ardour/ardour/route.h
libs/ardour/ardour/track.h
libs/ardour/ardour/types.h
libs/ardour/audio_diskstream.cc
libs/ardour/audio_track.cc
libs/ardour/auditioner.cc
libs/ardour/graph.cc
libs/ardour/midi_diskstream.cc
libs/ardour/midi_track.cc
libs/ardour/route.cc
libs/ardour/session_process.cc
libs/ardour/track.cc

index 237b62f07bcada01282fac334d28c0e10eb95fc7..5a06479a11e5bb87375f9d33f5e82b43bdaf0238 100644 (file)
@@ -168,8 +168,8 @@ style "monitor_input_button_alternate" = "small_button"
 {
        fg[NORMAL] = @@COLPREFIX@_fg
        fg[PRELIGHT] = @@COLPREFIX@_fg
-        bg[NORMAL] = mix(0.3,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg))
-        bg[PRELIGHT] = mix(0.3,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg))
+        bg[NORMAL] = mix(0.5,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg))
+        bg[PRELIGHT] = mix(0.5,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg))
 }
 
 style "monitor_disk_button" = "small_button"
@@ -192,8 +192,8 @@ style "monitor_disk_button_alternate" = "small_button"
 {
        fg[NORMAL] = @@COLPREFIX@_fg
        fg[PRELIGHT] = @@COLPREFIX@_fg
-        bg[NORMAL] = mix(0.3,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg))
-        bg[PRELIGHT] = mix(0.3,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg))
+        bg[NORMAL] = mix(0.5,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg))
+        bg[PRELIGHT] = mix(0.5,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg))
 }
 
 style "solo_button" = "small_button"
index 9dd2f815994626de4e3efa3cc9d557b06ddda4d5..ee978a4bd6b40cf5f420260463866dda4bd50359 100644 (file)
@@ -157,6 +157,7 @@ RouteUI::init ()
        _session->TransportStateChange.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::check_rec_enable_sensitivity, this), gui_context());
        _session->RecordStateChanged.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::session_rec_enable_changed, this), gui_context());
 
+       _session->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&RouteUI::parameter_changed, this, _1), gui_context());
        Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&RouteUI::parameter_changed, this, _1), gui_context());
 
        rec_enable_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_press), false);
@@ -593,22 +594,34 @@ RouteUI::monitoring_changed ()
 void
 RouteUI::update_monitoring_display ()
 {
+       if (!_route) {
+               return;
+       }
+
        boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
 
        if (!t) {
                return;
        }
 
-       MonitorChoice mc = t->monitoring();
+       MonitorState ms = t->monitoring_state();
 
-       if (mc & MonitorInput) {
-               monitor_input_button->set_visual_state (1);
+       if (ms & MonitoringInput) {
+               if (t->monitoring_choice() & MonitorInput) {
+                       monitor_input_button->set_visual_state (1);
+               } else {
+                       monitor_input_button->set_visual_state (2);
+               }
        } else {
                monitor_input_button->set_visual_state (0);
        }
 
-       if (mc & MonitorDisk) {
-               monitor_disk_button->set_visual_state (1);
+       if (ms & MonitoringDisk) {
+               if (t->monitoring_choice() & MonitorDisk) {
+                       monitor_disk_button->set_visual_state (1);
+               } else {
+                       monitor_disk_button->set_visual_state (2);
+               }
        } else {
                monitor_disk_button->set_visual_state (0);
        }
@@ -659,11 +672,11 @@ RouteUI::monitor_release (GdkEventButton* ev, MonitorChoice monitor_choice)
           signal together, which requires yet more buffers.
        */
 
-       if (t->monitoring() & monitor_choice) {
-               mc = MonitorChoice (t->monitoring() & ~monitor_choice);
+       if (t->monitoring_choice() & monitor_choice) {
+               mc = MonitorChoice (t->monitoring_choice() & ~monitor_choice);
        } else {
                /* this line will change when the options are non-orthogonal */
-               // mc = MonitorChoice (t->monitoring() | monitor_choice);
+               // mc = MonitorChoice (t->monitoring_choice() | monitor_choice);
                mc = monitor_choice;
        }
 
@@ -1129,12 +1142,14 @@ void
 RouteUI::route_rec_enable_changed ()
 {
         update_rec_display ();
+       update_monitoring_display ();
 }
 
 void
 RouteUI::session_rec_enable_changed ()
 {
         update_rec_display ();
+       update_monitoring_display ();
 }
 
 void
@@ -1722,15 +1737,21 @@ RouteUI::check_rec_enable_sensitivity ()
        } else {
                rec_enable_button->set_sensitive (true);
        }
+
+       update_monitoring_display ();
 }
 
 void
 RouteUI::parameter_changed (string const & p)
 {
+       /* this handles RC and per-session parameter changes */
+
        if (p == "disable-disarm-during-roll") {
                check_rec_enable_sensitivity ();
        } else if (p == "use-monitor-bus" || p == "solo-control-is-listen-control" || p == "listen-position") {
                set_button_names ();
+       } else if (p == "auto-input") {
+               update_monitoring_display ();
        }
 }
 
index f233e2111208586ddc357533f1f88e742bebe018..94c843971bc22c71dfc678f6e52ebdf2f45634eb 100644 (file)
@@ -171,7 +171,7 @@ class AudioDiskstream : public Diskstream
   protected:
        friend class AudioTrack;
 
-       int  process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler);
+       int  process (framepos_t transport_frame, pframes_t nframes, bool& need_butler);
        bool commit  (framecnt_t nframes);
 
   private:
index 445558ccdd20dc11f3224b2375e6832a3fe367a7..c39c7f564031058bbfbdd68593fe5d67f0f4dad2 100644 (file)
@@ -40,7 +40,7 @@ class AudioTrack : public Track
        bool can_use_mode (TrackMode m, bool& bounce_required);
 
        int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                 int declick, bool can_record, bool& need_butler);
+                 int declick, bool& need_butler);
 
        void use_new_diskstream ();
        void set_diskstream (boost::shared_ptr<Diskstream>);
index dad9501c8e60a60e6096381084c9a2180aa4c4c8..975c8d45da51663c48f264fa6441173ffe9b1476 100644 (file)
@@ -185,7 +185,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
   protected:
        friend class Track;
 
-       virtual int  process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler) = 0;
+       virtual int  process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) = 0;
        virtual bool commit  (framecnt_t nframes) = 0;
 
        //private:
index 0279fe8fd9698ae8dfa68ffd775513b7216175d5..0fa5b2f6c842e26c2336c1b301edbfcd94b80342 100644 (file)
@@ -74,13 +74,13 @@ public:
        void main_thread();
 
        int silent_process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                                  bool can_record, bool& need_butler);
+                                  bool& need_butler);
 
        int process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
-                           bool can_record, bool& need_butler);
+                           bool& need_butler);
 
        int routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                           bool non_rt_pending, bool can_record, int declick);
+                           bool non_rt_pending, int declick);
 
        void process_one_route (Route * route);
 
index d10640b51be39b1c2c344a090d6d05ab8edfe84b..0454b55e011116ec8af9bb98c8757a0bc52e86e2 100644 (file)
@@ -142,7 +142,7 @@ class MidiDiskstream : public Diskstream
   protected:
        friend class MidiTrack;
 
-       int  process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler);
+       int  process (framepos_t transport_frame, pframes_t nframes, bool& need_butler);
        bool commit  (framecnt_t nframes);
        static framecnt_t midi_readahead;
 
index 407a317433659042cc3a07d19232ca20eb940163..a2cc2e7d9d568506d43dd8c76f3713a8e0884e14 100644 (file)
@@ -41,8 +41,7 @@ public:
 
        int init ();
 
-       int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                 int declick, bool can_record, bool& need_butler);
+       int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler);
 
        void realtime_handle_transport_stopped ();
        void realtime_locate ();
@@ -133,8 +132,7 @@ protected:
        bool                      _midi_thru;
        bool                      _input_active;
 
-       int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                    bool state_changing, bool can_record);
+       int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing);
        void push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes);
 
        void diskstream_data_recorded (boost::shared_ptr<MidiBuffer>, boost::weak_ptr<MidiSource>);
index 91b95d33e779bcf5cca83ff380a05c877cec702d..e6e6a7e087bdb15acd67bb4997dec444c18bd50e 100644 (file)
@@ -109,13 +109,13 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
        /* these are the core of the API of a Route. see the protected sections as well */
 
        virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                         int declick, bool can_record, bool& need_butler);
+                         int declick, bool& need_butler);
 
        virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                            bool state_changing, bool can_record);
+                            bool state_changing);
 
        virtual int silent_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                                bool can_record, bool& need_butler);
+                                bool& need_butler);
 
        virtual void toggle_monitor_input ();
        virtual bool can_record() { return false; }
index b467ffb316fd64611dec8da6c51f2c42d8396b40..01b084641dfbef9c6528d0eadb96026127bee473 100644 (file)
@@ -49,17 +49,18 @@ class Track : public Route, public PublicDiskstream
        PBD::Signal0<void> TrackModeChanged;
 
        virtual void set_monitoring (MonitorChoice);
-       MonitorChoice monitoring() const { return _monitoring; }
+       MonitorChoice monitoring_choice() const { return _monitoring; }
+       MonitorState monitoring_state();
        PBD::Signal0<void> MonitoringChanged;
 
        virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                            bool state_changing, bool can_record);
+                            bool state_changing);
 
        int silent_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                        bool can_record, bool& need_butler);
+                        bool& need_butler);
 
        virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                         int declick, bool can_record, bool& need_butler) = 0;
+                         int declick, bool& need_butler) = 0;
 
        bool needs_butler() const { return _needs_butler; }
        void toggle_monitor_input ();
index e2daf1a76c3d413ce8e617730b7b647aeb84fbd2..417a9ed54d5f197edfbaa1c031e2bd671b7988ef 100644 (file)
@@ -365,6 +365,12 @@ namespace ARDOUR {
                MonitorCue = 0x4,
        };
 
+       enum MonitorState {
+               MonitoringSilence = 0x1,
+               MonitoringInput = 0x2,
+               MonitoringDisk = 0x4,
+       };
+
        enum PFLPosition {
                /** PFL signals come from before pre-fader processors */
                PFLFromBeforeProcessors,
index f5733cd6a498f1f12bcadb5a9fa140aa913979ee..7b0e466ae0bd86a3cb52c5575d8f0bb3606d8f7b 100644 (file)
@@ -406,7 +406,7 @@ AudioDiskstream::prepare_record_status(framepos_t capture_start_frame)
 }
 
 int
-AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler)
+AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& need_butler)
 {
        uint32_t n;
        boost::shared_ptr<ChannelList> c = channels.reader();
@@ -415,6 +415,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca
        framecnt_t rec_offset = 0;
        framecnt_t rec_nframes = 0;
        bool collect_playback = false;
+       bool can_record = _session.actively_recording ();
 
        playback_distance = 0;
 
@@ -567,8 +568,8 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca
                collect_playback = true;
        }
 
-       if ((_track->monitoring() & MonitorDisk) || collect_playback) {
-
+       if ((_track->monitoring_state () & MonitoringDisk) || collect_playback) {
+               
                /* we're doing playback */
 
                framecnt_t necessary_samples;
index 99217cfc0e457b36d85ba1488480930e548ca5b9..a4049b28a7bc52a026c93df0ee5af89f11974834 100644 (file)
@@ -353,10 +353,10 @@ AudioTrack::set_state_part_two ()
 }
 
 int
-AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
-                 bool can_record, bool& need_butler)
+AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler)
 {
        Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+
        if (!lm.locked()) {
                return 0;
        }
@@ -386,13 +386,13 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
                   playback distance to zero, thus causing diskstream::commit
                   to do nothing.
                */
-               return diskstream->process (transport_frame, 0, can_record, need_butler);
+               return diskstream->process (transport_frame, 0, need_butler);
        }
 
        _silent = false;
        _amp->apply_gain_automation(false);
 
-       if ((dret = diskstream->process (transport_frame, nframes, can_record, need_butler)) != 0) {
+       if ((dret = diskstream->process (transport_frame, nframes, need_butler)) != 0) {
                silence (nframes);
                return dret;
        }
@@ -403,14 +403,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
                _input->process_input (_meter, start_frame, end_frame, nframes);
        }
 
-       if ((_monitoring & MonitorInput) || (!(_monitoring & MonitorDisk) && 
-                                            (diskstream->record_enabled() && 
-                                             !can_record && 
-                                             !_session.config.get_auto_input()))) {
-               
-               /* not actually recording, but we want to hear the input material anyway,
-                  at least potentially (depending on monitoring options)
-                */
+       if (monitoring_state() == MonitoringInput) {
 
                passthru (start_frame, end_frame, nframes, false);
 
index b6544bbae68574c7bd4f0c19e9d352155ee03857..7ba5e966fc766d0410e172084a6864d1f390cf47 100644 (file)
@@ -223,7 +223,7 @@ Auditioner::play_audition (framecnt_t nframes)
 
        this_nframes = min (nframes, length - current_frame);
 
-       if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, false, need_butler)) != 0) {
+       if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, need_butler)) != 0) {
                silence (nframes);
                return ret;
        }
index f0d3075b30334836a35402ffe9815bba8596314c..cb5ac65f11075ee26c713979edc4067f37c1f6f7 100644 (file)
@@ -512,13 +512,11 @@ Graph::dump (int chain)
 }
 
 int
-Graph::silent_process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                              bool can_record, bool& need_butler)
+Graph::silent_process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool& need_butler)
 {
         _process_nframes = nframes;
         _process_start_frame = start_frame;
         _process_end_frame = end_frame;
-        _process_can_record = can_record;
 
         _process_silent = true;
         _process_noroll = false;
@@ -537,15 +535,13 @@ Graph::silent_process_routes (pframes_t nframes, framepos_t start_frame, framepo
 }
 
 int
-Graph::process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
-                       bool can_record, bool& need_butler)
+Graph::process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler)
 {
        DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("graph execution from %1 to %2 = %3\n", start_frame, end_frame, nframes));
 
         _process_nframes = nframes;
         _process_start_frame = start_frame;
         _process_end_frame = end_frame;
-        _process_can_record = can_record;
         _process_declick = declick;
 
         _process_silent = false;
@@ -566,14 +562,13 @@ Graph::process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end
 
 int
 Graph::routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                       bool non_rt_pending, bool can_record, int declick)
+                       bool non_rt_pending, int declick)
 {
        DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("no-roll graph execution from %1 to %2 = %3\n", start_frame, end_frame, nframes));
 
         _process_nframes = nframes;
         _process_start_frame = start_frame;
         _process_end_frame = end_frame;
-        _process_can_record = can_record;
         _process_declick = declick;
         _process_non_rt_pending = non_rt_pending;
 
@@ -599,13 +594,13 @@ Graph::process_one_route (Route* route)
         DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_self(), route->name()));
 
         if (_process_silent) {
-                retval = route->silent_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_can_record, need_butler);
+                retval = route->silent_roll (_process_nframes, _process_start_frame, _process_end_frame, need_butler);
         } else if (_process_noroll) {
                 route->set_pending_declick (_process_declick);
-                retval = route->no_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_non_rt_pending, _process_can_record);
+                retval = route->no_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_non_rt_pending);
         } else {
                 route->set_pending_declick (_process_declick);
-                retval = route->roll (_process_nframes, _process_start_frame, _process_end_frame, _process_declick, _process_can_record, need_butler);
+                retval = route->roll (_process_nframes, _process_start_frame, _process_end_frame, _process_declick, need_butler);
         }
 
         if (retval) {
index d13f638fa4e4497afcf916317831a37be635c36d..f252c8741eb33f8bc23118ef6e9464a0bac93478 100644 (file)
@@ -477,13 +477,14 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len)
 #endif
 
 int
-MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler)
+MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& need_butler)
 {
        int       ret = -1;
        framecnt_t rec_offset = 0;
        framecnt_t rec_nframes = 0;
        bool      nominally_recording;
        bool      re = record_enabled ();
+       bool      can_record = _session.actively_recording ();
 
        playback_distance = 0;
 
index fb323e12dc8e0b89aa5da2c215b8132a71a5a549..9145cad7f3d0608a1684a47cb0812dabe184d3aa 100644 (file)
@@ -312,8 +312,7 @@ MidiTrack::set_state_part_two ()
 }
 
 int
-MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
-                bool can_record, bool& needs_butler)
+MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& needs_butler)
 {
        Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
        if (!lm.locked()) {
@@ -341,12 +340,12 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
                   playback distance to zero, thus causing diskstream::commit
                   to do nothing.
                   */
-               return diskstream->process (transport_frame, 0, can_record, needs_butler);
+               return diskstream->process (transport_frame, 0, needs_butler);
        }
 
        _silent = false;
 
-       if ((dret = diskstream->process (transport_frame, nframes, can_record, needs_butler)) != 0) {
+       if ((dret = diskstream->process (transport_frame, nframes, needs_butler)) != 0) {
                silence (nframes);
                return dret;
        }
@@ -357,7 +356,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
                _input->process_input (_meter, start_frame, end_frame, nframes);
        }
 
-       if (should_monitor_input ()) { 
+       if (monitoring_state() == MonitoringInput) {
 
                /* not actually recording, but we want to hear the input material anyway,
                   at least potentially (depending on monitoring options)
@@ -411,10 +410,9 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
 }
 
 int
-MidiTrack::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                   bool state_changing, bool can_record)
+MidiTrack::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing)
 {
-       int ret = Track::no_roll (nframes, start_frame, end_frame, state_changing, can_record);
+       int ret = Track::no_roll (nframes, start_frame, end_frame, state_changing);
 
        if (ret == 0 && _step_editing) {
                push_midi_input_to_step_edit_ringbuffer (nframes);
index 97a6e200ba40f5e148e0bfe9f14b33746a5b723c..dcb85c9156d9d9d337eca8d11739f66d6033dacf 100644 (file)
@@ -2782,8 +2782,7 @@ Route::pans_required () const
 }
 
 int
-Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-               bool session_state_changing, bool /*can_record*/)
+Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing)
 {
        Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
        if (!lm.locked()) {
@@ -2820,8 +2819,7 @@ Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
 }
 
 int
-Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
-            bool /*can_record*/, bool& /* need_butler */)
+Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& /* need_butler */)
 {
        Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
        if (!lm.locked()) {
@@ -2853,8 +2851,7 @@ Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, in
 }
 
 int
-Route::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/,
-                   bool /*can_record*/, bool& /* need_butler */)
+Route::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/, bool& /* need_butler */)
 {
        silence (nframes);
        return 0;
index 4d974d483082a32a976d3e5603e19518b822274b..2384dd5fb32a24d0147af90c3368a880c8ba49e2 100644 (file)
@@ -109,7 +109,7 @@ Session::no_roll (pframes_t nframes)
 
        if (route_graph->threads_in_use() > 0) {
                DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/no-roll\n");
-               route_graph->routes_no_roll( nframes, _transport_frame, end_frame, non_realtime_work_pending(), actively_recording(), declick);
+               route_graph->routes_no_roll( nframes, _transport_frame, end_frame, non_realtime_work_pending(), declick);
        } else {
                for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
 
@@ -119,8 +119,7 @@ Session::no_roll (pframes_t nframes)
 
                        (*i)->set_pending_declick (declick);
 
-                       if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending(),
-                                          actively_recording())) {
+                       if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending())) {
                                error << string_compose(_("Session: error in no roll for %1"), (*i)->name()) << endmsg;
                                ret = -1;
                                break;
@@ -134,7 +133,6 @@ Session::no_roll (pframes_t nframes)
 int
 Session::process_routes (pframes_t nframes, bool& need_butler)
 {
-       bool record_active;
        int  declick = get_transport_declick_required();
        boost::shared_ptr<RouteList> r = routes.reader ();
 
@@ -143,8 +141,6 @@ Session::process_routes (pframes_t nframes, bool& need_butler)
                declick = -1;
        }
 
-       record_active = actively_recording(); // || (get_record_enabled() && get_punch_in());
-
        const framepos_t start_frame = _transport_frame;
        const framepos_t end_frame = _transport_frame + floor (nframes * _transport_speed);
 
@@ -154,7 +150,7 @@ Session::process_routes (pframes_t nframes, bool& need_butler)
        */
        if (1 || route_graph->threads_in_use() > 0) {
                DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/process-routes\n");
-               route_graph->process_routes (nframes, start_frame, end_frame, declick, record_active, need_butler);
+               route_graph->process_routes (nframes, start_frame, end_frame, declick, need_butler);
        } else {
 
                for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
@@ -167,7 +163,7 @@ Session::process_routes (pframes_t nframes, bool& need_butler)
 
                        (*i)->set_pending_declick (declick);
 
-                       if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, record_active, need_butler)) < 0) {
+                       if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, need_butler)) < 0) {
                                stop_transport ();
                                return -1;
                        }
@@ -180,7 +176,6 @@ Session::process_routes (pframes_t nframes, bool& need_butler)
 int
 Session::silent_process_routes (pframes_t nframes, bool& need_butler)
 {
-       bool record_active = actively_recording();
        boost::shared_ptr<RouteList> r = routes.reader ();
 
        const framepos_t start_frame = _transport_frame;
@@ -191,7 +186,7 @@ Session::silent_process_routes (pframes_t nframes, bool& need_butler)
           tracks, the graph never gets updated.
        */
        if (1 || route_graph->threads_in_use() > 0) {
-               route_graph->silent_process_routes (nframes, start_frame, end_frame, record_active, need_butler);
+               route_graph->silent_process_routes (nframes, start_frame, end_frame, need_butler);
        } else {
                for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
 
@@ -201,7 +196,7 @@ Session::silent_process_routes (pframes_t nframes, bool& need_butler)
                                continue;
                        }
 
-                       if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, need_butler)) < 0) {
+                       if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, need_butler)) < 0) {
                                stop_transport ();
                                return -1;
                        }
index fdb1665a31112b59beadf4bc3ef4c447a15ec67c..5693b86c42ff4c3cc60405aec0fb27c6715a2adb 100644 (file)
@@ -241,14 +241,15 @@ Track::zero_diskstream_id_in_xml (XMLNode& node)
 }
 
 int
-Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-               bool session_state_changing, bool can_record)
+Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing)
 {
        Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
        if (!lm.locked()) {
                return 0;
        }
 
+       bool can_record = _session.actively_recording ();
+
        if (n_outputs().n_total() == 0) {
                return 0;
        }
@@ -323,8 +324,7 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
 }
 
 int
-Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/,
-                   bool can_record, bool& need_butler)
+Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/, bool& need_butler)
 {
        Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
        if (!lm.locked()) {
@@ -345,7 +345,7 @@ Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*
 
        silence (nframes);
 
-       return _diskstream->process (_session.transport_frame(), nframes, can_record, need_butler);
+       return _diskstream->process (_session.transport_frame(), nframes, need_butler);
 }
 
 void
@@ -774,12 +774,47 @@ Track::set_monitoring (MonitorChoice mc)
        }
 }
 
-bool
-Track::should_monitor_input () 
+MonitorState
+Track::monitoring_state ()
 {
-       return (_monitoring & MonitorInput) || 
-               (!(_monitoring & MonitorDisk) && 
-                (diskstream->record_enabled() && 
-                 !can_record && 
-                 !_session.config.get_auto_input()));
+       MonitorState ms = MonitoringSilence;
+
+       if (_session.transport_rolling()) {
+               
+               /* roll case */
+
+               if ((_monitoring & MonitorInput) || // explicitly requested input monitoring
+                   (!(_monitoring & MonitorDisk) && // disk monitoring not requested
+                    (_diskstream->record_enabled() && // record-enabled BUT
+                     !_session.actively_recording() &&  // session NOT rec-armed
+                     !_session.config.get_auto_input()))) { // and auto-input is off
+
+                       ms = MonitoringInput;
+
+               } else {
+
+                       ms = MonitorState (0);
+               }
+               
+               if ((_monitoring & MonitorDisk) || // explicitly requested disk monitoring
+                   (!(_monitoring & MonitorInput) && // input monitoring not requested
+                    (_diskstream->record_enabled() && // record-enabled BUT
+                     (_session.actively_recording() || // session rec-armed OR 
+                      _session.config.get_auto_input())))) { // auto-input is ON (mon-input while rec-rolling
+                    
+                       ms = MonitorState (ms | MonitoringDisk);
+               }
+
+       } else {
+
+               /* no-roll case */
+
+               if (send_silence()) {
+                       ms = MonitoringSilence;
+               } else {
+                       ms = MonitoringInput;
+               }
+       }
+
+       return ms;
 }