reinstante code to setup latency related stuff after plugin changes etc (removed...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 21 Sep 2011 16:46:02 +0000 (16:46 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 21 Sep 2011 16:46:02 +0000 (16:46 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@10107 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/audioengine.h
libs/ardour/audioengine.cc
libs/ardour/session.cc

index 7325c1359200427db1638beb428f93d46c219098..e855411a48ab1ec7e52a4b67dba80882e715aba7 100644 (file)
@@ -169,6 +169,8 @@ class AudioEngine : public sigc::trackable
 
        int  reset_timebase ();
 
+        void update_latencies ();
+
        /* start/stop freewheeling */
 
        int freewheel (bool onoff);
index 7b519a9ddb30ec42b5743bca1b571289897f121b..bbe188590d718bfecdcb9c925f36bd893ff0b88e 100644 (file)
@@ -1432,3 +1432,12 @@ AudioEngine::port_is_mine (const string& portname) const
         }
         return true;
 }
+
+void
+AudioEngine::update_latencies ()
+{
+        if (jack_recompute_total_latencies) {
+                GET_PRIVATE_JACK_POINTER (_jack);
+                jack_recompute_total_latencies (_priv_jack);
+        }
+}
index 11ba8682c7a5f0be7a34d0aa27207076965a4171..5f38fb7a0b9533aab511c0b470eb5b25cbe277a5 100644 (file)
@@ -4413,6 +4413,8 @@ Session::sync_order_keys (const char* base)
 void
 Session::update_latency (bool playback)
 {
+        // cerr << "::update latency (playback = " << playback << ")\n";
+
        if (_state_of_the_state & (InitialConnecting|Deletion)) {
                return;
        }
@@ -4535,7 +4537,7 @@ Session::set_worst_playback_latency ()
                _worst_output_latency = max (_worst_output_latency, (*i)->output_latency());
        }
 
-        cerr << "Session: worst output latency = " << _worst_output_latency << endl;
+        // cerr << "Session: worst output latency = " << _worst_output_latency << endl;
 }
 
 void
@@ -4557,7 +4559,7 @@ Session::set_worst_capture_latency ()
                _worst_input_latency = max (_worst_input_latency, (*i)->input_latency());
        }
 
-        cerr << "Session: worst input latency = " << _worst_input_latency << endl;
+        // cerr << "Session: worst input latency = " << _worst_input_latency << endl;
 }
 
 void
@@ -4583,5 +4585,20 @@ Session::update_latency_compensation (bool force_whole_graph)
                        _worst_track_latency = max (tl, _worst_track_latency);
                }
        }
+
+        if (some_track_latency_changed || force_whole_graph) {
+                _engine.update_latencies ();
+        }
+
+        set_worst_io_latencies ();
+
+        /* reflect any changes in latencies into capture offsets
+         */
+        
+        boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
+        
+        for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) {
+                (*i)->set_capture_offset ();
+        }
 }