diff options
author | Robin Gareus <robin@gareus.org> | 2019-03-18 06:15:12 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-03-18 06:15:12 +0100 |
commit | 09fd380948a4519f7d50b2e0c5349cfda8b17456 (patch) | |
tree | ed01e8608e9977cd64b12470deaadea667df0257 /libs/ardour/audioengine.cc | |
parent | e545e6691155169f321ad8cb20133769320e3b9c (diff) |
Avoid calling rt-methods from non-rt context
Since upcoming state-machine transitions are done in rt-context
via ARDOUR::Session::process_event () they should all in rt-context.
set_session() is called from the UI thread (and the process-lock wasn't
even taken)
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r-- | libs/ardour/audioengine.cc | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 65a76f745a..4ba6f6cf0a 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -100,6 +100,7 @@ AudioEngine::AudioEngine () , _hw_devicelist_update_count(0) , _stop_hw_devicelist_processing(0) , _start_cnt (0) + , _init_countdown (0) #ifdef SILENCE_AFTER_SECONDS , _silence_countdown (0) , _silence_hit_cnt (0) @@ -248,6 +249,16 @@ AudioEngine::process_callback (pframes_t nframes) thread_init_callback (NULL); } + if (_session && _init_countdown > 0) { + --_init_countdown; + /* Warm up caches */ + PortManager::cycle_start (nframes); + PortManager::silence (nframes); + _session->process (nframes); + PortManager::cycle_end (nframes); + return 0; + } + bool return_after_remove_check = false; if (_measuring_latency == MeasureAudio && _mtdm) { @@ -643,21 +654,7 @@ AudioEngine::set_session (Session *s) SessionHandlePtr::set_session (s); if (_session) { - - pframes_t blocksize = samples_per_cycle (); - - PortManager::cycle_start (blocksize); - - _session->process (blocksize); - _session->process (blocksize); - _session->process (blocksize); - _session->process (blocksize); - _session->process (blocksize); - _session->process (blocksize); - _session->process (blocksize); - _session->process (blocksize); - - PortManager::cycle_end (blocksize); + _init_countdown = 8; } } |