diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index c0350a7802..a4ee9dc587 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -728,7 +728,7 @@ AudioEngine::set_session (Session *s) SessionHandlePtr::set_session (s); if (_session) { - _init_countdown = std::max (8, (int)(_backend->sample_rate () / _backend->buffer_size ()) / 2); + _init_countdown = std::max (8, (int)(_backend->sample_rate () / _backend->buffer_size ()) / 4); } } diff --git a/libs/backends/alsa/alsa_audiobackend.cc b/libs/backends/alsa/alsa_audiobackend.cc index 357b00c044..947b6d5992 100644 --- a/libs/backends/alsa/alsa_audiobackend.cc +++ b/libs/backends/alsa/alsa_audiobackend.cc @@ -2086,7 +2086,6 @@ AlsaAudioBackend::main_process_thread () double dll_w2 = dll_w1 * dll_w1; uint64_t clock1; - _pcmi->pcm_start (); int no_proc_errors = 0; const int bailout = 5 * _samplerate / _samples_per_period; @@ -2095,6 +2094,21 @@ AlsaAudioBackend::main_process_thread () const double sr_norm = 1e-6 * (double) _samplerate / (double)_samples_per_period; + /* warm up */ + int cnt = std::max (8, (int)(_samplerate / _samples_per_period) / 2); + for (int w = 0; w < cnt; ++w) { + for (std::vector::const_iterator it = _system_inputs.begin (); it != _system_inputs.end (); ++it) { + memset ((*it)->get_buffer (_samples_per_period), 0, _samples_per_period * sizeof (Sample)); + } + if (engine.process_callback (_samples_per_period)) { + _active = false; + return 0; + } + Glib::usleep (1000000 * (_samples_per_period / _samplerate )); + } + + _pcmi->pcm_start (); + while (_run) { long nr; bool xrun = false; diff --git a/libs/backends/alsa/zita-alsa-pcmi.cc b/libs/backends/alsa/zita-alsa-pcmi.cc index 534d183025..a35b2b3f03 100644 --- a/libs/backends/alsa/zita-alsa-pcmi.cc +++ b/libs/backends/alsa/zita-alsa-pcmi.cc @@ -230,7 +230,7 @@ snd_pcm_sframes_t Alsa_pcmi::pcm_wait (void) { _state = -1; if (!recover ()) { - _state = 1; + _state = 1; } return 0; } @@ -239,7 +239,7 @@ snd_pcm_sframes_t Alsa_pcmi::pcm_wait (void) { _state = -1; if (!recover ()) { - _state = 1; + _state = 1; } return 0; }