AudioEngine tweaks from Tracks, related to stopping audioengine and halting
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 13 May 2015 15:01:37 +0000 (11:01 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 29 Jun 2015 18:18:14 +0000 (14:18 -0400)
libs/ardour/audioengine.cc

index de41caae465ade4a7be6138d44e3aaf767a2e25c..f277deaea6f6d568c358b620089f5f964caea1a8 100644 (file)
@@ -770,7 +770,7 @@ void
 AudioEngine::drop_backend ()
 {
        if (_backend) {
-               stop(false);
+               _backend->stop ();
                _backend->drop_device ();
                _backend.reset ();
                _running = false;
@@ -858,18 +858,20 @@ AudioEngine::stop (bool for_latency)
                return 0;
        }
 
-       if (_session && _running) {
-               // it's not a halt, but should be handled the same way:
-               // disable record, stop transport and I/O processign but save the data.
-               _session->engine_halted ();
-       }
-
        Glib::Threads::Mutex::Lock lm (_process_lock);
 
        if (_backend->stop ()) {
                return -1;
        }
        
+       if (_session && _running &&
+           (_session->state_of_the_state() & Session::Loading) == 0 &&
+           (_session->state_of_the_state() & Session::Deletion) == 0) {
+               // it's not a halt, but should be handled the same way:
+               // disable record, stop transport and I/O processign but save the data.
+               _session->engine_halted ();
+       }
+
        _running = false;
        _processed_frames = 0;
        _measuring_latency = MeasureNone;