summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/ConnectionImpl.cpp3
-rw-r--r--src/engine/MessageContext.cpp21
-rw-r--r--src/engine/MessageContext.hpp12
-rw-r--r--src/engine/events/SetPortValue.cpp2
4 files changed, 19 insertions, 19 deletions
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp
index 1973397d..db71df70 100644
--- a/src/engine/ConnectionImpl.cpp
+++ b/src/engine/ConnectionImpl.cpp
@@ -157,8 +157,7 @@ ConnectionImpl::queue(Context& context)
_queue->write(sizeof(LV2_Object) + obj->size, obj);
src_buf->increment();
- context.engine().message_context()->run(_dst_port->parent_node(),
- context.start() + ev->frames);
+ context.engine().message_context()->run(_dst_port, context.start() + ev->frames);
}
}
diff --git a/src/engine/MessageContext.cpp b/src/engine/MessageContext.cpp
index 6e08eb8d..1ffc4bfc 100644
--- a/src/engine/MessageContext.cpp
+++ b/src/engine/MessageContext.cpp
@@ -23,6 +23,7 @@
#include "NodeImpl.hpp"
#include "PatchImpl.hpp"
#include "PortImpl.hpp"
+#include "PortImpl.hpp"
#include "ProcessContext.hpp"
#include "ThreadManager.hpp"
@@ -32,20 +33,20 @@ namespace Ingen {
void
-MessageContext::run(NodeImpl* node, FrameTime time)
+MessageContext::run(PortImpl* port, FrameTime time)
{
if (ThreadManager::current_thread_id() == THREAD_PRE_PROCESS) {
- assert(node);
+ assert(port);
Glib::Mutex::Lock lock(_mutex);
- _non_rt_request = Request(time, node);
+ _non_rt_request = Request(time, port);
_sem.post();
_cond.wait(_mutex);
} else if (ThreadManager::current_thread_id() == THREAD_PROCESS) {
- Request r(time, node);
+ Request r(time, port);
_requests.write(sizeof(Request), &r);
// signal() will be called at the end of this process cycle
} else if (ThreadManager::current_thread_id() == THREAD_MESSAGE) {
- cout << "Message context recursion at " << node->path() << endl;
+ cout << "Message context recursion at " << port->path() << endl;
} else {
cout << "[MessageContext] ERROR: Run requested from unknown thread" << endl;
}
@@ -64,7 +65,7 @@ MessageContext::_run()
{
Glib::Mutex::Lock lock(_mutex);
const Request req = _non_rt_request;
- if (req.node) {
+ if (req.port) {
_queue.insert(req);
_end_time = std::max(_end_time, req.time);
_cond.broadcast(); // Notify caller we got the message
@@ -74,7 +75,7 @@ MessageContext::_run()
// Enqueue (and thereby sort) requests from audio thread
while (has_requests()) {
_requests.full_read(sizeof(Request), &req);
- if (req.node) {
+ if (req.port) {
_queue.insert(req);
} else {
_end_time = req.time;
@@ -103,7 +104,7 @@ MessageContext::_run()
void
MessageContext::execute(const Request& req)
{
- NodeImpl* node = req.node;
+ NodeImpl* node = req.port->parent_node();
node->message_run(*this);
void* valid_ports = node->valid_ports();
@@ -116,8 +117,8 @@ MessageContext::execute(const Request& req)
PatchImpl::Connections& wires = patch->connections();
for (PatchImpl::Connections::iterator c = wires.begin(); c != wires.end(); ++c) {
ConnectionImpl* ci = dynamic_cast<ConnectionImpl*>(c->get());
- if (ci->src_port() == p) {
- _queue.insert(Request(req.time, ci->dst_port()->parent_node()));
+ if (ci->src_port() == p && ci->dst_port()->context() == Context::MESSAGE) {
+ _queue.insert(Request(req.time, ci->dst_port()));
}
}
}
diff --git a/src/engine/MessageContext.hpp b/src/engine/MessageContext.hpp
index 4d8c0695..1195d7f5 100644
--- a/src/engine/MessageContext.hpp
+++ b/src/engine/MessageContext.hpp
@@ -31,7 +31,7 @@
namespace Ingen {
-class NodeImpl;
+class PortImpl;
/** Context of a message_run() call.
*
@@ -55,16 +55,16 @@ public:
Thread::set_context(THREAD_MESSAGE);
}
- /** Request a run starting at node.
+ /** Schedule a port value change at a certain time.
* Safe to call from either process thread or pre-process thread.
*/
- void run(NodeImpl* node, FrameTime time);
+ void run(PortImpl* port, FrameTime time);
protected:
struct Request {
- Request(FrameTime t=0, NodeImpl* n=0) : time(t), node(n) {}
+ Request(FrameTime t=0, PortImpl* p=0) : time(t), port(p) {}
FrameTime time;
- NodeImpl* node;
+ PortImpl* port;
};
public:
@@ -87,7 +87,7 @@ protected:
/** Thread run method (wait for and execute requests from process thread */
void _run();
- /** Actually execute and propagate from node */
+ /** Execute a request (possibly enqueueing more requests) */
void execute(const Request& req);
Raul::Semaphore _sem;
diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp
index 3d235cd1..085d328c 100644
--- a/src/engine/events/SetPortValue.cpp
+++ b/src/engine/events/SetPortValue.cpp
@@ -119,7 +119,7 @@ SetPortValue::pre_process()
if (_port && _port->context() == Context::MESSAGE) {
apply(*_engine.message_context());
_port->parent_node()->set_port_valid(_port->index());
- _engine.message_context()->run(_port->parent_node(),
+ _engine.message_context()->run(_port,
_engine.audio_driver()->frame_time() + _engine.audio_driver()->buffer_size());
}