Consolidate ambiguous engine API calls
authorRobin Gareus <robin@gareus.org>
Wed, 28 Nov 2018 14:24:47 +0000 (15:24 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 28 Nov 2018 14:24:47 +0000 (15:24 +0100)
available(), connected(), running() were ill-defined and
used interchangeably.

libs/ardour/port.cc
libs/ardour/route.cc
libs/ardour/session.cc
libs/ardour/session_export.cc
libs/ardour/session_transport.cc

index 3c31094daeedf3d78e855c22bd4590787ea644a3..eb7ca913d2b3921c6552df135019c1d999244d95 100644 (file)
@@ -72,7 +72,7 @@ Port::Port (std::string const & n, DataType t, PortFlags f)
 
        assert (_name.find_first_of (':') == std::string::npos);
 
-       if (!port_engine.available ()) {
+       if (!port_manager->running ()) {
                DEBUG_TRACE (DEBUG::Ports, string_compose ("port-engine n/a postpone registering %1\n", name()));
                _port_handle = 0; // created during ::reestablish() later
        } else if ((_port_handle = port_engine.register_port (_name, t, _flags)) == 0) {
@@ -205,7 +205,7 @@ Port::connected_to (std::string const & o) const
                return false;
        }
 
-       if (!port_engine.available()) {
+       if (!port_manager->running()) {
                return false;
        }
 
@@ -215,7 +215,7 @@ Port::connected_to (std::string const & o) const
 int
 Port::get_connections (std::vector<std::string> & c) const
 {
-       if (!port_engine.available()) {
+       if (!port_manager->running()) {
                c.insert (c.end(), _connections.begin(), _connections.end());
                return c.size();
        }
index a05ccbe9030b90b77e7852f3d7e9f0cf0cfb4046..9a2559e2404be3be5a960ed59d1703137382bd9c 100644 (file)
@@ -1286,7 +1286,7 @@ Route::ab_plugins (bool forward)
 void
 Route::clear_processors (Placement p)
 {
-       if (!_session.engine().connected()) {
+       if (!_session.engine().running()) {
                return;
        }
 
@@ -1391,7 +1391,7 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
                return 0;
        }
 
-       if (!_session.engine().connected()) {
+       if (!_session.engine().running()) {
                return 1;
        }
 
@@ -1507,7 +1507,7 @@ Route::replace_processor (boost::shared_ptr<Processor> old, boost::shared_ptr<Pr
                return 1;
        }
 
-       if (!AudioEngine::instance()->connected() || !old || !sub) {
+       if (!AudioEngine::instance()->running() || !old || !sub) {
                return 1;
        }
 
@@ -1588,7 +1588,7 @@ Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams*
 {
        ProcessorList deleted;
 
-       if (!_session.engine().connected()) {
+       if (!_session.engine().running()) {
                return 1;
        }
 
@@ -3283,7 +3283,7 @@ Route::remove_aux_or_listen (boost::shared_ptr<Route> route)
                                /* list could have been demolished while we dropped the lock
                                   so start over.
                                */
-                               if (_session.engine().connected()) {
+                               if (_session.engine().running()) {
                                        /* i/o processors cannot be removed if the engine is not running
                                         * so don't live-loop in case the engine is N/A or dies
                                         */
index 6fd6a9474c1e629bf64bd66926cd97b487757a8c..1a33adc7d167b86adfbf802f1682f1a05a6cbf50 100644 (file)
@@ -6931,7 +6931,7 @@ Session::set_worst_output_latency ()
 
        _worst_output_latency = 0;
 
-       if (!_engine.connected()) {
+       if (!_engine.running()) {
                return;
        }
 
@@ -6955,7 +6955,7 @@ Session::set_worst_input_latency ()
 
        _worst_input_latency = 0;
 
-       if (!_engine.connected()) {
+       if (!_engine.running()) {
                return;
        }
 
index 879f34020af63004387fe0314a118004c9e54fc7..37bdbebe5db9a0a1e86c36bc280ff0aafc7807c0 100644 (file)
@@ -172,7 +172,7 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex
 
        /* we are ready to go ... */
 
-       if (!_engine.connected()) {
+       if (!_engine.running()) {
                return -1;
        }
 
index 99ce3e46ed28dcd8a20fd2b2b46a291bd67e1dae..cc46cffad9dcc515be726080afa165d4534acc95 100644 (file)
@@ -925,7 +925,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
           because there will be no process callbacks to deliver stuff from
        */
 
-       if (_engine.connected() && !_engine.freewheeling()) {
+       if (_engine.running() && !_engine.freewheeling()) {
                // need to queue this in the next RT cycle
                _send_timecode_update = true;