provide Session::have_rec_disabled_track()
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 8 May 2015 17:46:42 +0000 (13:46 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 29 Jun 2015 18:18:10 +0000 (14:18 -0400)
libs/ardour/ardour/session.h
libs/ardour/session.cc

index bbc82939c7ccb64095e09e8e6c19c613607dc182..bdb3c3f7921cf9a5d8e4363d0f60ab22d249470a 100644 (file)
@@ -214,6 +214,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO);
 
        bool have_rec_enabled_track () const;
+    bool have_rec_disabled_track () const;
 
        bool have_captured() const { return _have_captured; }
 
@@ -1678,6 +1679,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        void update_have_rec_enabled_track ();
        gint _have_rec_enabled_track;
+    gint _have_rec_disabled_track;
 
        static int ask_about_playlist_deletion (boost::shared_ptr<Playlist>);
 
index 56b8f2b739f83adc460b8741b69c6e4c7f6b4eb8..dc00ecd8932571b26bd0ae87daee9c424103597c 100644 (file)
@@ -269,6 +269,7 @@ Session::Session (AudioEngine &eng,
        , first_file_header_format_reset (true)
        , have_looped (false)
        , _have_rec_enabled_track (false)
+    , _have_rec_disabled_track (true)
        , _step_editors (0)
        , _suspend_timecode_transmission (0)
        ,  _speakers (new Speakers)
@@ -4977,6 +4978,12 @@ Session::have_rec_enabled_track () const
        return g_atomic_int_get (const_cast<gint*>(&_have_rec_enabled_track)) == 1;
 }
 
+bool
+Session::have_rec_disabled_track () const
+{
+    return g_atomic_int_get (const_cast<gint*>(&_have_rec_disabled_track)) == 1;
+}
+
 /** Update the state of our rec-enabled tracks flag */
 void
 Session::update_have_rec_enabled_track ()
@@ -5000,6 +5007,20 @@ Session::update_have_rec_enabled_track ()
        if (g_atomic_int_get (&_have_rec_enabled_track) != old) {
                RecordStateChanged (); /* EMIT SIGNAL */
        }
+
+    
+    i = rl->begin();
+       while (i != rl->end ()) {
+        
+               boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+               if (tr && !tr->record_enabled ()) {
+                       break;
+               }
+        
+               ++i;
+       }
+    
+    g_atomic_int_set (&_have_rec_disabled_track, i != rl->end () ? 1 : 0);
 }
 
 void