From cfce7723dd18d7746f591c9de890ebaaf1bd6463 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 31 Jul 2012 16:34:13 +0000 Subject: Fix running as an LV2 plugin. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4585 a436a847-0d15-0410-975c-d299462d15a1 --- src/AtomReader.cpp | 2 +- src/server/Engine.cpp | 4 ++++ src/server/ingen_lv2.cpp | 17 +++++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index 0482cacd..f27cd5a5 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -261,7 +261,7 @@ AtomReader::write(const LV2_Atom* msg) } _iface.response(((LV2_Atom_Int*)request)->body, (Ingen::Status)((LV2_Atom_Int*)body)->body, - subject_uri); + subject_uri ? subject_uri : ""); } else { Raul::warn << "Unknown object type <" << _map.unmap_uri(obj->body.otype) diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 3e7ab4d0..f2957616 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -137,6 +137,10 @@ Engine::set_driver(SharedPtr driver) SampleCount Engine::event_time() { + if (ThreadManager::single_threaded) { + return 0; + } + const SampleCount start = _direct_driver ? _process_context.start() : _driver->frame_time(); diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index feb63a3a..ccbeb7d4 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -522,22 +522,17 @@ ingen_instantiate(const LV2_Descriptor* descriptor, Server::ThreadManager::set_flag(Server::THREAD_PRE_PROCESS); Server::ThreadManager::single_threaded = true; - // FIXME: fixed (or at least maximum) buffer size - LV2Driver* driver = new LV2Driver(*engine.get(), 4096, rate); + LV2Driver* driver = new LV2Driver(*engine.get(), block_length, rate); engine->set_driver(SharedPtr(driver)); plugin->main = new MainThread(engine, driver); - SharedPtr client(&driver->writer(), NullDeleter); - interface->set_respondee(client); - engine->register_client("http://drobilla.net/ns/ingen#internal", client); - engine->activate(); Server::ThreadManager::single_threaded = true; - engine->process_context().locate(0, UINT_MAX, 0); + engine->process_context().locate(0, block_length, 0); - engine->post_processor()->set_end_time(UINT_MAX); + engine->post_processor()->set_end_time(block_length); engine->process_events(); engine->post_processor()->process(); @@ -550,6 +545,12 @@ ingen_instantiate(const LV2_Descriptor* descriptor, engine->post_processor()->process(); } + /* Register client after loading patch so the to-ui ring does not overflow. + Since we are not yet rolling, it won't be drained, causing a deadlock. */ + SharedPtr client(&driver->writer(), NullDeleter); + interface->set_respondee(client); + engine->register_client("http://drobilla.net/ns/ingen#internal", client); + return (LV2_Handle)plugin; } -- cgit v1.2.1