don't show engine dialog when loading a session..
authorRobin Gareus <robin@gareus.org>
Tue, 26 Apr 2016 10:56:52 +0000 (12:56 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 26 Apr 2016 10:56:52 +0000 (12:56 +0200)
..and the engine is running at the desired samplerate

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

index 5734ec4c87509806e75c69ec09b558aeaaa9ea6f..f81ff3efcd1b4bc40bcfb551161fe6840a21aaf8 100644 (file)
@@ -1414,7 +1414,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        void             auto_loop_changed (Location *);
        void             auto_loop_declick_range (Location *, framepos_t &, framepos_t &);
 
-       int  ensure_engine (uint32_t desired_sample_rate);
+       int  ensure_engine (uint32_t desired_sample_rate, bool);
        void pre_engine_init (std::string path);
        int  post_engine_init ();
        int  immediately_post_engine ();
index 38324075c458a01d98c17e7514a6cfacf20bf5db..6555d27f8109190ffb4ccee791d5c0fd074098b7 100644 (file)
@@ -333,7 +333,7 @@ Session::Session (AudioEngine &eng,
 #ifdef USE_TRACKS_CODE_FEATURES
                sr = EngineStateController::instance()->get_current_sample_rate();
 #endif
-               if (ensure_engine (sr)) {
+               if (ensure_engine (sr, true)) {
                        destroy ();
                        throw SessionException (_("Cannot connect to audio/midi engine"));
                }
@@ -387,7 +387,7 @@ Session::Session (AudioEngine &eng,
                        }
                }
 
-               if (ensure_engine (sr)) {
+               if (ensure_engine (sr, false)) {
                        destroy ();
                        throw SessionException (_("Cannot connect to audio/midi engine"));
                }
@@ -500,7 +500,7 @@ Session::init_name_id_counter (guint n)
 }
 
 int
-Session::ensure_engine (uint32_t desired_sample_rate)
+Session::ensure_engine (uint32_t desired_sample_rate, bool isnew)
 {
        if (_engine.current_backend() == 0) {
                /* backend is unknown ... */
@@ -508,6 +508,8 @@ Session::ensure_engine (uint32_t desired_sample_rate)
                if (r.get_value_or (-1) != 0) {
                        return -1;
                }
+       } else if (!isnew && _engine.running() && _engine.sample_rate () == desired_sample_rate) {
+               /* keep engine */
        } else if (_engine.setup_required()) {
                /* backend is known, but setup is needed */
                boost::optional<int> r = AudioEngineSetupRequired (desired_sample_rate);
@@ -520,8 +522,7 @@ Session::ensure_engine (uint32_t desired_sample_rate)
                }
        }
 
-       /* at this point the engine should be running
-       */
+       /* at this point the engine should be running */
 
        if (!_engine.running()) {
                return -1;