summaryrefslogtreecommitdiff
path: root/libs/ardour/audioengine.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-03-29 01:44:03 +0100
committerRobin Gareus <robin@gareus.org>2020-03-29 01:44:03 +0100
commitf81442c3bfd315d15b566ccc7a1f295b3fd5c235 (patch)
tree81b96ce2ad05141bde361ac956310421155afda4 /libs/ardour/audioengine.cc
parent9873e1d211e1e5033d710aa5acefe2dcd9cfea1c (diff)
Engine: Silence outputs for 1/2 second when loading a session
This allows for caches to warm up, background worker threads to spin up and things settle down. This also prevents initial audible artifacts of live input. In almost all cases this completes before the GUI is brought up.
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r--libs/ardour/audioengine.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index b82b9628f8..c525c33fd4 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -288,9 +288,12 @@ AudioEngine::process_callback (pframes_t nframes)
--_init_countdown;
/* Warm up caches */
PortManager::cycle_start (nframes);
- PortManager::silence (nframes);
_session->process (nframes);
+ PortManager::silence (nframes);
PortManager::cycle_end (nframes);
+ if (_init_countdown == 0) {
+ _session->reset_xrun_count();
+ }
return 0;
}
@@ -723,7 +726,7 @@ AudioEngine::set_session (Session *s)
SessionHandlePtr::set_session (s);
if (_session) {
- _init_countdown = 8;
+ _init_countdown = std::max (8, (int)(_backend->sample_rate () / _backend->buffer_size ()) / 2);
}
}