diff options
-rw-r--r-- | libs/ardour/audioengine.cc | 15 | ||||
-rw-r--r-- | libs/ardour/globals.cc | 3 |
2 files changed, 14 insertions, 4 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 3fbc7635e1..612a3fd0e0 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -39,6 +39,7 @@ #include "midi++/mmc.h" #include "ardour/async_midi_port.h" +#include "ardour/ardour.h" #include "ardour/audio_port.h" #include "ardour/audio_backend.h" #include "ardour/audioengine.h" @@ -930,10 +931,22 @@ AudioEngine::start (bool for_latency) PortManager::fill_midi_port_info (); if (!for_latency) { + /* Call the library-wide ::init_post_engine() before emitting + * running to ensure that its tasks are complete before any + * signal handlers execute. PBD::Signal does not ensure + * ordering of signal handlers so even if ::init_post_engine() + * is connected first, it may not run first. + */ + + ARDOUR::init_post_engine (_start_cnt); + Running (_start_cnt); /* EMIT SIGNAL */ + + /* latency start/stop cycles do not count as "starts" */ + + _start_cnt++; } - _start_cnt++; return 0; } diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 749a706e85..7038049c3a 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -561,9 +561,6 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir ARDOUR::AudioEngine::create (); - /* This will run in whatever thread calls AudioEngine::start() */ - ARDOUR::AudioEngine::instance()->Running.connect_same_thread (engine_startup_connection, ARDOUR::init_post_engine); - /* it is unfortunate that we need to include reserved names here that refer to control surfaces. But there's no way to ensure a complete lack of collisions without doing this, since the control surface |