summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events/RequestPortValueEvent.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-08 03:58:00 +0000
committerDavid Robillard <d@drobilla.net>2006-09-08 03:58:00 +0000
commit48f87f1f1649fb7e169fdaac2cd38370e8a4a1fa (patch)
tree9da4b4b075791ac1ec78b499dbcbec6101f54690 /src/libs/engine/events/RequestPortValueEvent.cpp
parentacbe9a26ec3ab689e430225d15e95e73a7378aa9 (diff)
downloadingen-48f87f1f1649fb7e169fdaac2cd38370e8a4a1fa.tar.gz
ingen-48f87f1f1649fb7e169fdaac2cd38370e8a4a1fa.tar.bz2
ingen-48f87f1f1649fb7e169fdaac2cd38370e8a4a1fa.zip
De-singleton-ified Engine
Slight rework of Responder/ClientKey/ClientInterface for Requests git-svn-id: http://svn.drobilla.net/lad/ingen@119 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events/RequestPortValueEvent.cpp')
-rw-r--r--src/libs/engine/events/RequestPortValueEvent.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp
index d02eed6a..830ef852 100644
--- a/src/libs/engine/events/RequestPortValueEvent.cpp
+++ b/src/libs/engine/events/RequestPortValueEvent.cpp
@@ -28,8 +28,8 @@ using std::string;
namespace Ingen {
-RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path)
-: QueuedEvent(responder, timestamp),
+RequestPortValueEvent::RequestPortValueEvent(Engine& engine, CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path)
+: QueuedEvent(engine, responder, timestamp),
m_port_path(port_path),
m_port(NULL),
m_value(0.0),
@@ -41,22 +41,24 @@ RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, Sa
void
RequestPortValueEvent::pre_process()
{
- m_client = _responder->find_client();
- m_port = Engine::instance().object_store()->find_port(m_port_path);
+ m_client = _engine.client_broadcaster()->client(_responder->client_key());
+ m_port = _engine.object_store()->find_port(m_port_path);
QueuedEvent::pre_process();
}
void
-RequestPortValueEvent::execute(SampleCount offset)
+RequestPortValueEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
+ assert(_time >= start && _time <= end);
+
if (m_port != NULL && m_port->type() == DataType::FLOAT)
- m_value = ((TypedPort<Sample>*)m_port)->buffer(0)->value_at(offset);
+ m_value = ((TypedPort<Sample>*)m_port)->buffer(0)->value_at(_time - start);
else
m_port = NULL; // triggers error response
- QueuedEvent::execute(offset);
+ QueuedEvent::execute(nframes, start, end);
}
@@ -70,7 +72,7 @@ RequestPortValueEvent::post_process()
_responder->respond_ok();
m_client->control_change(m_port_path, m_value);
} else {
- _responder->respond_error("Invalid URL");
+ _responder->respond_error("Unable to find client to send port value");
}
}