summaryrefslogtreecommitdiffstats
path: root/src/engine/ingen_lv2.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-03-06 21:15:14 +0000
committerDavid Robillard <d@drobilla.net>2010-03-06 21:15:14 +0000
commit32ed8eb92f194d0cce1b0617d0686147d4be09c0 (patch)
treeaecbd03f668bf87a8863cd441ddeecf298dbc02b /src/engine/ingen_lv2.cpp
parent2bfa0960c87e569d4efdb5bd7db896b2dfdb9e8b (diff)
downloadingen-32ed8eb92f194d0cce1b0617d0686147d4be09c0.tar.gz
ingen-32ed8eb92f194d0cce1b0617d0686147d4be09c0.tar.bz2
ingen-32ed8eb92f194d0cce1b0617d0686147d4be09c0.zip
Fully load patch in LV2 instantiate method.
Actually connect to LV2 buffers. Ingen confirmed working as an LV2 plugin doing audio I/O in lv2_jack_host and Ardour. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2536 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/ingen_lv2.cpp')
-rw-r--r--src/engine/ingen_lv2.cpp49
1 files changed, 33 insertions, 16 deletions
diff --git a/src/engine/ingen_lv2.cpp b/src/engine/ingen_lv2.cpp
index 8d14cba7..56d73cdb 100644
--- a/src/engine/ingen_lv2.cpp
+++ b/src/engine/ingen_lv2.cpp
@@ -25,19 +25,20 @@
#include "raul/log.hpp"
#include "raul/Thread.hpp"
#include "raul/SharedPtr.hpp"
-#include "engine/AudioBuffer.hpp"
-#include "engine/Engine.hpp"
-#include "engine/ThreadManager.hpp"
-#include "engine/Driver.hpp"
-#include "engine/ProcessContext.hpp"
-#include "engine/PatchImpl.hpp"
-#include "engine/QueuedEngineInterface.hpp"
+#include "interface/EngineInterface.hpp"
#include "module/World.hpp"
#include "module/ingen_module.hpp"
#include "shared/runtime_paths.hpp"
#include "shared/Configuration.hpp"
+#include "engine/AudioBuffer.hpp"
+#include "engine/Driver.hpp"
+#include "engine/Engine.hpp"
+#include "engine/PatchImpl.hpp"
+#include "engine/PostProcessor.hpp"
+#include "engine/ProcessContext.hpp"
+#include "engine/QueuedEngineInterface.hpp"
+#include "engine/ThreadManager.hpp"
#include "serialisation/Parser.hpp"
-#include "interface/EngineInterface.hpp"
using namespace Ingen;
@@ -132,6 +133,8 @@ public:
for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i)
(*i)->pre_process(_context);
+ _context.engine().process_events(_context);
+
if (_root_patch)
_root_patch->process(_context);
@@ -193,6 +196,8 @@ public:
virtual bool is_realtime() const { return true; }
virtual ProcessContext& context() { return _context; }
+ Ports& ports() { return _ports; }
+
private:
ProcessContext _context;
PatchImpl* _root_patch;
@@ -254,27 +259,31 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
Raul::Thread::get().set_context(THREAD_PRE_PROCESS);
ThreadManager::single_threaded = true;
- ProcessContext context(*engine.get());
-
// FIXME: fixed (or at least maximum) buffer size
engine->set_driver(SharedPtr<Driver>(new LV2Driver(*engine.get(), rate, 4096)));
engine->activate();
ThreadManager::single_threaded = true;
+ ProcessContext context(*engine.get());
+ context.locate(0, UINT_MAX, 0);
+
+ engine->post_processor()->set_end_time(UINT_MAX);
+
// FIXME: don't load all plugins, only necessary ones
plugin->world->engine()->load_plugins();
- engine->process_events(context);
+ interface->process(*engine->post_processor(), context, false);
+ engine->post_processor()->process();
plugin->world->parser()->parse_document(plugin->world,
plugin->world->engine().get(), patch->filename);
- engine->process_events(context);
- engine->deactivate();
+ while (!interface->empty()) {
+ interface->process(*engine->post_processor(), context, false);
+ engine->post_processor()->process();
+ }
- // Activate and deactivate to create root patch, allocate buffers, etc
- //engine->activate();
- //engine->deactivate();
+ engine->deactivate();
return (LV2_Handle)plugin;
}
@@ -283,6 +292,14 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
static void
ingen_connect_port(LV2_Handle instance, uint32_t port, void* data)
{
+ IngenPlugin* me = (IngenPlugin*)instance;
+ LV2::LV2Driver* driver = (LV2::LV2Driver*)me->world->local_engine()->driver();
+ if (port < driver->ports().size()) {
+ driver->ports().at(port)->set_buffer(data);
+ assert(driver->ports().at(port)->patch_port()->index() == port);
+ } else {
+ Raul::warn << "Connect to non-existent port " << port << std::endl;
+ }
}