summaryrefslogtreecommitdiff
path: root/libs/ardour/globals.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2019-01-16 15:29:21 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2019-01-16 15:29:38 -0600
commit4c064081af23656c6b1bef756e23b20b9770a213 (patch)
treeccc99fc9b7e22192209432a93f96aafb13d8839a /libs/ardour/globals.cc
parentcd70c6bda5b34bc254a5bf0f1e462f988c631f6a (diff)
(libs) call ARDOUR::init_post_engine() from within libardour rather than requiring "users" of the library to arrange for it
Diffstat (limited to 'libs/ardour/globals.cc')
-rw-r--r--libs/ardour/globals.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 77aff20c1a..b40db9466c 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -161,6 +161,8 @@ extern void setup_enum_writer ();
*/
PBD::PropertyChange ARDOUR::bounds_change;
+static PBD::ScopedConnection engine_startup_connection;
+
void
setup_hardware_optimization (bool try_optimization)
{
@@ -559,6 +561,9 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir
ARDOUR::AudioEngine::create ();
+ /* This will run only once 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
@@ -594,7 +599,7 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir
}
void
-ARDOUR::init_post_engine ()
+ARDOUR::init_post_engine (uint32_t /* ignored */)
{
XMLNode* node;
@@ -617,6 +622,12 @@ ARDOUR::init_post_engine ()
/* find plugins */
ARDOUR::PluginManager::instance().refresh (!Config->get_discover_vst_on_start());
+
+ /* Don't do this again - we are only meant to execute on the first
+ * engine start, not any subsequence starts
+ */
+
+ engine_startup_connection.disconnect ();
}
void
@@ -626,6 +637,8 @@ void
return;
}
+ engine_startup_connection.disconnect ();
+
delete &ControlProtocolManager::instance();
ARDOUR::AudioEngine::destroy ();