summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/EventSource.cpp7
-rw-r--r--src/engine/EventSource.hpp4
-rw-r--r--src/engine/JackDriver.cpp1
-rw-r--r--src/engine/ingen_lv2.cpp49
4 files changed, 39 insertions, 22 deletions
diff --git a/src/engine/EventSource.cpp b/src/engine/EventSource.cpp
index 9e1f2741..271bb0a1 100644
--- a/src/engine/EventSource.cpp
+++ b/src/engine/EventSource.cpp
@@ -61,7 +61,7 @@ EventSource::push_queued(QueuedEvent* const ev)
* Executed events will be pushed to @a dest.
*/
void
-EventSource::process(PostProcessor& dest, ProcessContext& context)
+EventSource::process(PostProcessor& dest, ProcessContext& context, bool limit)
{
ThreadManager::assert_thread(THREAD_PROCESS);
@@ -82,7 +82,8 @@ EventSource::process(PostProcessor& dest, ProcessContext& context)
while (ev && ev->is_prepared() && ev->time() < context.end()) {
ev->execute(context);
new_head = new_head->next();
- if (++num_events_processed > MAX_QUEUED_EVENTS)
+ ++num_events_processed;
+ if (limit && num_events_processed > MAX_QUEUED_EVENTS)
break;
ev = (new_head ? (QueuedEvent*)new_head->elem() : NULL);
}
@@ -105,8 +106,6 @@ EventSource::_whipped()
QueuedEvent* const ev = (QueuedEvent*)pb->elem();
assert(ev);
- if (!ev)
- return;
assert(!ev->is_prepared());
ev->pre_process();
diff --git a/src/engine/EventSource.hpp b/src/engine/EventSource.hpp
index d3d813e0..b13efad0 100644
--- a/src/engine/EventSource.hpp
+++ b/src/engine/EventSource.hpp
@@ -45,7 +45,9 @@ public:
virtual void activate_source() { Slave::start(); }
virtual void deactivate_source() { Slave::stop(); }
- void process(PostProcessor& dest, ProcessContext& context);
+ void process(PostProcessor& dest, ProcessContext& context, bool limit=true);
+
+ bool empty() { return _events.empty(); }
/** Signal that a blocking event is finished.
*
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp
index 6e973e1f..b6911ffd 100644
--- a/src/engine/JackDriver.cpp
+++ b/src/engine/JackDriver.cpp
@@ -470,7 +470,6 @@ JackDriver::_process_cb(jack_nframes_t nframes)
for (Raul::List<JackPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i)
(*i)->post_process(_process_context);
-
return 0;
}
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;
+ }
}