diff options
author | David Robillard <d@drobilla.net> | 2016-10-14 21:49:59 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-10-14 21:49:59 -0400 |
commit | 1eccad7a9361a2e98d0b7178f8ee655610802630 (patch) | |
tree | 4ee3c8e2d1941fb4e7ea969cbdb9abd7f6fd4986 | |
parent | 883b9b94bae3e3ba1164d09ca398b2b1f856b35a (diff) | |
download | ingen-1eccad7a9361a2e98d0b7178f8ee655610802630.tar.gz ingen-1eccad7a9361a2e98d0b7178f8ee655610802630.tar.bz2 ingen-1eccad7a9361a2e98d0b7178f8ee655610802630.zip |
Fix LV2 initialisation
-rw-r--r-- | src/server/Engine.cpp | 6 | ||||
-rw-r--r-- | src/server/Engine.hpp | 3 | ||||
-rw-r--r-- | src/server/ingen_lv2.cpp | 16 |
3 files changed, 18 insertions, 7 deletions
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 2d458bc4..6e61f463 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -458,6 +458,12 @@ Engine::process_events() run_context(), *_post_processor, MAX_EVENTS_PER_CYCLE); } +unsigned +Engine::process_all_events() +{ + return _pre_processor->process(run_context(), *_post_processor, 0); +} + void Engine::register_client(SPtr<Interface> client) { diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index d7e4f87b..5be18faf 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -117,6 +117,9 @@ public: /** Process events (process thread only). */ unsigned process_events(); + /** Process all events (no RT limits). */ + unsigned process_all_events(); + Ingen::World* world() const { return _world; } Interface* interface() const { return _interface.get(); } diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index cc01f68a..40d5b664 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -560,22 +560,24 @@ ingen_instantiate(const LV2_Descriptor* descriptor, engine->activate(); Server::ThreadManager::single_threaded = true; - engine->locate(0, block_length); + std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex()); + // Locate to time 0 to process initialization events + engine->locate(0, block_length); engine->post_processor()->set_end_time(block_length); - engine->process_events(); - engine->post_processor()->process(); - - std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex()); - fprintf(stderr, "LV2 parse resource %s from %s\n", graph->uri.c_str(), graph->filename.c_str()); + // Parse graph, filling the queue with events to create it + plugin->world->interface()->bundle_begin(); plugin->world->parser()->parse_file(plugin->world, plugin->world->interface().get(), graph->filename); + plugin->world->interface()->bundle_end(); + // Drain event queue while (engine->pending_events()) { - engine->process_events(); + engine->process_all_events(); engine->post_processor()->process(); + engine->maid()->cleanup(); } /* Register client after loading graph so the to-ui ring does not overflow. |