From ed9e1aa15e5a9363653b46e12313878f82652393 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 28 Jul 2008 23:10:41 +0000 Subject: Fix loading patches from command line (partially). git-svn-id: http://svn.drobilla.net/lad/ingen@1298 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/DeprecatedLoader.cpp | 1 - src/libs/engine/NodeFactory.cpp | 19 ++++--------------- src/progs/ingen/main.cpp | 25 +++++++++++++++---------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index 77d743eb..889ef6ed 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -383,7 +383,6 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr // Compatibility hacks for old patches that represent patch ports as nodes if (plugin_uri == "") { - cerr << "WARNING: Loading deprecated Node. Resave! " << path << endl; bool is_port = false; if (plugin_type == "Internal") { diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp index 733dc6b1..949a5928 100644 --- a/src/libs/engine/NodeFactory.cpp +++ b/src/libs/engine/NodeFactory.cpp @@ -103,6 +103,8 @@ void NodeFactory::load_plugins() { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); + + _world->rdf_world->mutex().lock(); // Only load if we havn't already, so every client connecting doesn't cause // this (expensive!) stuff to happen. Not the best solution - would be nice @@ -123,21 +125,8 @@ NodeFactory::load_plugins() _has_loaded = true; } -#if 0 - for (Plugins::const_iterator i = _plugins.begin(); i != _plugins.end(); ++i) { - assert(Path::is_valid_name(i->second->symbol())); - cerr << "PLUGIN: " << i->second->uri() << " - " << i->second->symbol() - << " (" << i->second->name() << ")" << endl; - PatchImpl* parent = new PatchImpl(*_world->local_engine, "dummy", 1, NULL, 1, 1, 1); - NodeImpl* node = i->second->instantiate("foo", 0, parent, 48000, 512); - if (node) - for (uint32_t i=0; i < node->num_ports(); ++i) { - cerr << "\t" << node->port(i)->name() << endl; - } - cerr << endl; - } -#endif - + _world->rdf_world->mutex().unlock(); + //cerr << "[NodeFactory] # Plugins: " << _plugins.size() << endl; } diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp index 5be5a8d3..23609ee2 100644 --- a/src/progs/ingen/main.cpp +++ b/src/progs/ingen/main.cpp @@ -97,32 +97,39 @@ main(int argc, char** argv) /* Run engine */ if (args.engine_flag) { - engine_module = Ingen::Shared::load_module("ingen_engine"); - if (engine_module) { Engine* (*new_engine)(Ingen::Shared::World* world) = NULL; if (engine_module->get_symbol("new_engine", (void*&)new_engine)) { engine = SharedPtr(new_engine(world)); world->local_engine = engine; + /* Load queued (direct in-process) engine interface */ + if (!args.connect_given) { + engine_interface = engine->new_queued_interface(); + world->engine = engine_interface; + } } else { engine_module.reset(); } } else { cerr << "Unable to load engine module." << endl; } - } bool use_osc = false; - /* Connect to remote engine */ - if (args.connect_given || (args.load_given && !engine_interface)) { - bool found = false; + /* Load client library */ + if (args.connect_given || args.load_given) { client_module = Ingen::Shared::load_module("ingen_client"); + if (!client_module) + cerr << "Unable to load client module." << endl; + } + /* Connect to remote engine */ + if (args.connect_given || (args.load_given && !engine_interface)) { SharedPtr (*new_osc_interface)(const std::string&) = NULL; + bool found = false; if (client_module) found = client_module->get_symbol("new_osc_interface", (void*&)new_osc_interface); @@ -135,10 +142,6 @@ main(int argc, char** argv) } } - /* Load queued (direct in-process) engine interface */ - if (engine && !engine_interface && (args.load_given || args.gui_given || args.run_given)) { - engine_interface = engine->new_queued_interface(); - } if (engine && engine_interface) { @@ -180,6 +183,8 @@ main(int argc, char** argv) Glib::get_current_dir(), args.load_arg)); } + + engine_interface->load_plugins(); loader->load(world, uri, parent_path, ""); } else { -- cgit v1.2.1