reinstate missing latency initialization code
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 16 Dec 2019 23:13:27 +0000 (16:13 -0700)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 16 Dec 2019 23:13:39 +0000 (16:13 -0700)
Removed (mistakenly) during work on transportFSM

libs/ardour/ardour/session.h
libs/ardour/port.cc
libs/ardour/session.cc
libs/ardour/session_state.cc

index 5491f49df4ef8953e35c4696235f708bc734c43f..b4ecb87f59ad3f4a5e52040fa0244eecd427ace8 100644 (file)
@@ -1318,6 +1318,7 @@ private:
        void update_latency (bool playback);
        bool update_route_latency (bool reverse, bool apply_to_delayline);
 
+       void initialize_latencies ();
        void set_worst_io_latencies ();
        void set_worst_output_latency ();
        void set_worst_input_latency ();
index a8e80ad98cf5283ccc81a171673be92df7f53a39..d4c1f63803b642c17cd95d2fb0ac68b82f78b3ba 100644 (file)
@@ -382,6 +382,7 @@ Port::set_private_latency_range (LatencyRange& range, bool playback)
                                     name(),
                                     _private_playback_latency.min,
                                     _private_playback_latency.max));
+               PBD::stacktrace (std::cerr, 20);
        } else {
                _private_capture_latency = range;
                DEBUG_TRACE (DEBUG::Latency, string_compose (
index 31a57b3b1ca221a975c9355505abaa2055fd2a3a..09e5634f5e5b6fff958a3b8c510a95be13018652 100644 (file)
@@ -492,6 +492,10 @@ Session::immediately_post_engine ()
                _process_graph.reset (new Graph (*this));
        }
 
+       /* every time we reconnect, recompute worst case output latencies */
+
+       _engine.Running.connect_same_thread (*this, boost::bind (&Session::initialize_latencies, this));
+
        /* Restart transport FSM */
 
        _transport_fsm->start ();
@@ -6328,6 +6332,18 @@ Session::unknown_processors () const
        return p;
 }
 
+void
+Session::initialize_latencies ()
+{
+        {
+                Glib::Threads::Mutex::Lock lm (_engine.process_lock());
+                update_latency (false);
+                update_latency (true);
+        }
+
+        set_worst_io_latencies ();
+}
+
 void
 Session::set_worst_io_latencies_x (IOChange, void *)
 {
index f61c197a0a58bfeb780069f1a823a2412dc01357..605803d85f62f6083181a198a6f74865e647c33d 100644 (file)
@@ -365,6 +365,10 @@ Session::post_engine_init ()
 
                _state_of_the_state = StateOfTheState (_state_of_the_state & ~(CannotSave | Dirty));
 
+               /* update latencies */
+
+               initialize_latencies ();
+
                _locations->added.connect_same_thread (*this, boost::bind (&Session::location_added, this, _1));
                _locations->removed.connect_same_thread (*this, boost::bind (&Session::location_removed, this, _1));
                _locations->changed.connect_same_thread (*this, boost::bind (&Session::locations_changed, this));