summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-07-31 16:34:13 +0000
committerDavid Robillard <d@drobilla.net>2012-07-31 16:34:13 +0000
commitcfce7723dd18d7746f591c9de890ebaaf1bd6463 (patch)
tree6562f79762eb8cde1e422ec25ace29cd012abf8b
parent8d559e4991a491b612e63d5a4deff0ab48a3d3dd (diff)
downloadingen-cfce7723dd18d7746f591c9de890ebaaf1bd6463.tar.gz
ingen-cfce7723dd18d7746f591c9de890ebaaf1bd6463.tar.bz2
ingen-cfce7723dd18d7746f591c9de890ebaaf1bd6463.zip
Fix running as an LV2 plugin.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4585 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/AtomReader.cpp2
-rw-r--r--src/server/Engine.cpp4
-rw-r--r--src/server/ingen_lv2.cpp17
3 files changed, 14 insertions, 9 deletions
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> 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<Ingen::Server::Driver>(driver));
plugin->main = new MainThread(engine, driver);
- SharedPtr<Interface> client(&driver->writer(), NullDeleter<Interface>);
- 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<Interface> client(&driver->writer(), NullDeleter<Interface>);
+ interface->set_respondee(client);
+ engine->register_client("http://drobilla.net/ns/ingen#internal", client);
+
return (LV2_Handle)plugin;
}