13
0

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.
This commit is contained in:
Robin Gareus 2020-03-29 01:44:03 +01:00
parent 9873e1d211
commit f81442c3bf
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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);
}
}