summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Connect.cpp30
-rw-r--r--src/server/events/Connect.hpp2
-rw-r--r--src/server/events/CreateNode.cpp44
-rw-r--r--src/server/events/CreateNode.hpp5
-rw-r--r--src/server/events/CreatePatch.cpp42
-rw-r--r--src/server/events/CreatePatch.hpp3
-rw-r--r--src/server/events/CreatePort.cpp33
-rw-r--r--src/server/events/CreatePort.hpp2
-rw-r--r--src/server/events/Delete.cpp9
-rw-r--r--src/server/events/Delete.hpp2
-rw-r--r--src/server/events/Disconnect.cpp22
-rw-r--r--src/server/events/Disconnect.hpp2
-rw-r--r--src/server/events/DisconnectAll.cpp21
-rw-r--r--src/server/events/DisconnectAll.hpp2
-rw-r--r--src/server/events/Get.cpp12
-rw-r--r--src/server/events/Get.hpp3
-rw-r--r--src/server/events/Move.cpp23
-rw-r--r--src/server/events/Move.hpp2
-rw-r--r--src/server/events/SetMetadata.cpp58
-rw-r--r--src/server/events/SetMetadata.hpp2
-rw-r--r--src/server/events/SetPortValue.cpp25
-rw-r--r--src/server/events/SetPortValue.hpp2
22 files changed, 134 insertions, 212 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index 8fec67f6..64f81e78 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -55,7 +55,7 @@ Connect::Connect(Engine& engine,
, _buffers(NULL)
{}
-void
+bool
Connect::pre_process()
{
Glib::RWLock::ReaderLock rlock(_engine.engine_store()->lock());
@@ -63,39 +63,29 @@ Connect::pre_process()
PortImpl* tail = _engine.engine_store()->find_port(_tail_path);
PortImpl* head = _engine.engine_store()->find_port(_head_path);
if (!tail || !head) {
- _status = PORT_NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PORT_NOT_FOUND);
}
_dst_input_port = dynamic_cast<InputPort*>(head);
_src_output_port = dynamic_cast<OutputPort*>(tail);
if (!_dst_input_port || !_src_output_port) {
- _status = DIRECTION_MISMATCH;
- Event::pre_process();
- return;
+ return Event::pre_process_done(DIRECTION_MISMATCH);
}
NodeImpl* const src_node = tail->parent_node();
NodeImpl* const dst_node = head->parent_node();
if (!src_node || !dst_node) {
- _status = PARENT_NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PARENT_NOT_FOUND);
}
if (src_node->parent() != dst_node->parent()
&& src_node != dst_node->parent()
&& src_node->parent() != dst_node) {
- _status = PARENT_DIFFERS;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PARENT_DIFFERS);
}
if (!EdgeImpl::can_connect(_src_output_port, _dst_input_port)) {
- _status = TYPE_MISMATCH;
- Event::pre_process();
- return;
+ return Event::pre_process_done(TYPE_MISMATCH);
}
if (src_node->parent_patch() != dst_node->parent_patch()) {
@@ -115,9 +105,7 @@ Connect::pre_process()
}
if (_patch->has_edge(_src_output_port, _dst_input_port)) {
- _status = EXISTS;
- Event::pre_process();
- return;
+ return Event::pre_process_done(EXISTS);
}
_edge = SharedPtr<EdgeImpl>(
@@ -149,14 +137,12 @@ Connect::pre_process()
if (_patch->enabled())
_compiled_patch = _patch->compile();
- Event::pre_process();
+ return Event::pre_process_done(SUCCESS);
}
void
Connect::execute(ProcessContext& context)
{
- Event::execute(context);
-
if (_status == SUCCESS) {
// This must be inserted here, since they're actually used by the audio thread
_dst_input_port->add_edge(context, _edge.get());
diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp
index f5939386..8a93200f 100644
--- a/src/server/events/Connect.hpp
+++ b/src/server/events/Connect.hpp
@@ -55,7 +55,7 @@ public:
const Raul::Path& tail,
const Raul::Path& head);
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();
diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp
index 4c2d1382..756f937d 100644
--- a/src/server/events/CreateNode.cpp
+++ b/src/server/events/CreateNode.cpp
@@ -39,43 +39,43 @@ CreateNode::CreateNode(Engine& engine,
int32_t id,
SampleCount timestamp,
const Raul::Path& path,
- const Raul::URI& plugin_uri,
const Resource::Properties& properties)
: Event(engine, client, id, timestamp)
, _path(path)
- , _plugin_uri(plugin_uri)
, _properties(properties)
, _patch(NULL)
, _node(NULL)
, _compiled_patch(NULL)
{}
-void
+bool
CreateNode::pre_process()
{
Ingen::Shared::URIs& uris = _engine.world()->uris();
+ typedef Resource::Properties::const_iterator iterator;
+
+ const iterator t = _properties.find(uris.ingen_prototype);
+ if (t != _properties.end() && t->second.type() == uris.forge.URI) {
+ _plugin_uri = t->second.get_uri();
+ } else {
+ return Event::pre_process_done(BAD_REQUEST);
+ }
+
if (_engine.engine_store()->find_object(_path)) {
- _status = EXISTS;
- Event::pre_process();
- return;
+ return Event::pre_process_done(EXISTS);
}
if (!(_patch = _engine.engine_store()->find_patch(_path.parent()))) {
- _status = PARENT_NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PARENT_NOT_FOUND);
}
- PluginImpl* plugin = _engine.node_factory()->plugin(_plugin_uri.str());
+ PluginImpl* plugin = _engine.node_factory()->plugin(_plugin_uri);
if (!plugin) {
- _status = PLUGIN_NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PLUGIN_NOT_FOUND);
}
- const Resource::Properties::const_iterator p = _properties.find(
- _engine.world()->uris().ingen_polyphonic);
+ const iterator p = _properties.find(uris.ingen_polyphonic);
const bool polyphonic = (
p != _properties.end() &&
p->second.type() == _engine.world()->forge().Bool &&
@@ -86,9 +86,7 @@ CreateNode::pre_process()
polyphonic,
_patch,
_engine))) {
- _status = CREATION_FAILED;
- Event::pre_process();
- return;
+ return Event::pre_process_done(CREATION_FAILED);
}
_node->properties().insert(_properties.begin(), _properties.end());
@@ -115,14 +113,12 @@ CreateNode::pre_process()
_update.push_back(std::make_pair(port->path(), pprops));
}
- Event::pre_process();
+ return Event::pre_process_done(SUCCESS);
}
void
CreateNode::execute(ProcessContext& context)
{
- Event::execute(context);
-
if (_node) {
_engine.maid()->push(_patch->compiled_patch());
_patch->compiled_patch(_compiled_patch);
@@ -132,10 +128,8 @@ CreateNode::execute(ProcessContext& context)
void
CreateNode::post_process()
{
- if (_status) {
- respond(_status);
- } else {
- respond(SUCCESS);
+ respond(_status);
+ if (!_status) {
for (Update::const_iterator i = _update.begin(); i != _update.end(); ++i) {
_engine.broadcaster()->put(i->first, i->second);
}
diff --git a/src/server/events/CreateNode.hpp b/src/server/events/CreateNode.hpp
index 95d504de..90b2b2b6 100644
--- a/src/server/events/CreateNode.hpp
+++ b/src/server/events/CreateNode.hpp
@@ -45,10 +45,9 @@ public:
int32_t id,
SampleCount timestamp,
const Raul::Path& node_path,
- const Raul::URI& plugin_uri,
const Resource::Properties& properties);
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();
@@ -57,7 +56,7 @@ private:
typedef std::list< std::pair<Raul::URI, Resource::Properties> > Update;
Raul::Path _path;
- Raul::URI _plugin_uri;
+ std::string _plugin_uri;
Resource::Properties _properties;
Update _update;
PatchImpl* _patch;
diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp
index 92d7a5e3..575cf11e 100644
--- a/src/server/events/CreatePatch.cpp
+++ b/src/server/events/CreatePatch.cpp
@@ -36,7 +36,6 @@ CreatePatch::CreatePatch(Engine& engine,
int32_t id,
SampleCount timestamp,
const Raul::Path& path,
- int poly,
const Resource::Properties& properties)
: Event(engine, client, id, timestamp)
, _path(path)
@@ -44,37 +43,38 @@ CreatePatch::CreatePatch(Engine& engine,
, _patch(NULL)
, _parent(NULL)
, _compiled_patch(NULL)
- , _poly(poly)
+ , _poly(1)
{
+ Ingen::Shared::URIs& uris = _engine.world()->uris();
+ typedef Resource::Properties::const_iterator iterator;
+ iterator p = _properties.find(uris.ingen_polyphony);
+ if (p != _properties.end() && p->second.type() == uris.forge.Int) {
+ _poly = p->second.get_int32();
+ }
}
-void
+bool
CreatePatch::pre_process()
{
if (_path.is_root() || _engine.engine_store()->find_object(_path) != NULL) {
- _status = EXISTS;
- Event::pre_process();
- return;
+ return Event::pre_process_done(EXISTS);
}
if (_poly < 1) {
- _status = INVALID_POLY;
- Event::pre_process();
- return;
+ return Event::pre_process_done(INVALID_POLY);
}
const Raul::Path& path = (const Raul::Path&)_path;
_parent = _engine.engine_store()->find_patch(path.parent());
- if (_parent == NULL) {
- _status = PARENT_NOT_FOUND;
- Event::pre_process();
- return;
+ if (!_parent) {
+ return Event::pre_process_done(PARENT_NOT_FOUND);
}
uint32_t poly = 1;
- if (_parent != NULL && _poly > 1 && _poly == static_cast<int>(_parent->internal_poly()))
+ if (_poly > 1 && _poly == static_cast<int>(_parent->internal_poly())) {
poly = _poly;
+ }
const Ingen::Shared::URIs& uris = _engine.world()->uris();
@@ -85,12 +85,10 @@ CreatePatch::pre_process()
_patch->add_property(uris.rdf_type,
Resource::Property(uris.ingen_Node, Resource::EXTERNAL));
- if (_parent) {
- _parent->add_node(new PatchImpl::Nodes::Node(_patch));
- if (_parent->enabled()) {
- _patch->enable();
- _compiled_patch = _parent->compile();
- }
+ _parent->add_node(new PatchImpl::Nodes::Node(_patch));
+ if (_parent->enabled()) {
+ _patch->enable();
+ _compiled_patch = _parent->compile();
}
_patch->activate(*_engine.buffer_factory());
@@ -100,14 +98,12 @@ CreatePatch::pre_process()
_update = _patch->properties();
- Event::pre_process();
+ return Event::pre_process_done(SUCCESS);
}
void
CreatePatch::execute(ProcessContext& context)
{
- Event::execute(context);
-
if (_patch) {
assert(_parent);
assert(!_path.is_root());
diff --git a/src/server/events/CreatePatch.hpp b/src/server/events/CreatePatch.hpp
index 0747ec06..95f24641 100644
--- a/src/server/events/CreatePatch.hpp
+++ b/src/server/events/CreatePatch.hpp
@@ -40,10 +40,9 @@ public:
int32_t id,
SampleCount timestamp,
const Raul::Path& path,
- int poly,
const Resource::Properties& properties);
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index a783512f..9f061238 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -81,30 +81,21 @@ CreatePort::CreatePort(Engine& engine,
_buffer_type = _engine.world()->uri_map().map_uri(i->second.get_uri());
}
}
-
- if (_port_type == PortType::UNKNOWN) {
- _status = UNKNOWN_TYPE;
- }
}
-void
+bool
CreatePort::pre_process()
{
- if (_status) {
- Event::pre_process();
- return;
+ if (_port_type == PortType::UNKNOWN) {
+ return Event::pre_process_done(UNKNOWN_TYPE);
}
if (_engine.engine_store()->find_object(_path)) {
- _status = EXISTS;
- Event::pre_process();
- return;
+ return Event::pre_process_done(_status);
}
if (!(_patch = _engine.engine_store()->find_patch(_path.parent()))) {
- _status = PARENT_NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PARENT_NOT_FOUND);
}
const Ingen::Shared::URIs& uris = _engine.world()->uris();
@@ -124,9 +115,7 @@ CreatePort::pre_process()
_engine.world()->forge().make(int32_t(old_num_ports))));
} else if (index_i->second.type() != uris.forge.Int
|| index_i->second.get_int32() != static_cast<int32_t>(old_num_ports)) {
- _status = BAD_INDEX;
- Event::pre_process();
- return;
+ return Event::pre_process_done(BAD_INDEX);
}
Resource::Properties::const_iterator poly_i = _properties.find(uris.ingen_polyphonic);
@@ -137,9 +126,7 @@ CreatePort::pre_process()
if (!(_patch_port = _patch->create_port(
*_engine.buffer_factory(), _path.symbol(),
_port_type, _buffer_type, buffer_size, _is_output, polyphonic))) {
- _status = CREATION_FAILED;
- Event::pre_process();
- return;
+ return Event::pre_process_done(CREATION_FAILED);
}
_patch_port->properties().insert(_properties.begin(), _properties.end());
@@ -168,19 +155,17 @@ CreatePort::pre_process()
assert(_ports_array->size() == _patch->num_ports_non_rt());
} else {
- _status = CREATION_FAILED;
+ return Event::pre_process_done(CREATION_FAILED);
}
_update = _patch_port->properties();
- Event::pre_process();
+ return Event::pre_process_done(SUCCESS);
}
void
CreatePort::execute(ProcessContext& context)
{
- Event::execute(context);
-
if (_patch_port) {
_engine.maid()->push(_patch->external_ports());
_patch->external_ports(_ports_array);
diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp
index 3b40136e..3952b1b7 100644
--- a/src/server/events/CreatePort.hpp
+++ b/src/server/events/CreatePort.hpp
@@ -49,7 +49,7 @@ public:
bool is_output,
const Resource::Properties& properties);
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index d54bcab4..5e7dd20e 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -60,12 +60,11 @@ Delete::~Delete()
delete _disconnect_event;
}
-void
+bool
Delete::pre_process()
{
if (_path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") {
- Event::pre_process();
- return;
+ return Event::pre_process_done(NOT_DELETABLE);
}
_lock.acquire();
@@ -125,14 +124,12 @@ Delete::pre_process()
}
- Event::pre_process();
+ return Event::pre_process_done(SUCCESS);
}
void
Delete::execute(ProcessContext& context)
{
- Event::execute(context);
-
PatchImpl* parent_patch = NULL;
if (_patch_node_listnode) {
diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp
index 2ca24469..4316763f 100644
--- a/src/server/events/Delete.hpp
+++ b/src/server/events/Delete.hpp
@@ -65,7 +65,7 @@ public:
~Delete();
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index e1a86b13..fc6813ea 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -111,7 +111,7 @@ Disconnect::Impl::Impl(Engine& e,
}
}
-void
+bool
Disconnect::pre_process()
{
Glib::RWLock::WriterLock lock(_engine.engine_store()->lock());
@@ -119,18 +119,14 @@ Disconnect::pre_process()
if (_tail_path.parent().parent() != _head_path.parent().parent()
&& _tail_path.parent() != _head_path.parent().parent()
&& _tail_path.parent().parent() != _head_path.parent()) {
- _status = PARENT_DIFFERS;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PARENT_DIFFERS);
}
_tail = _engine.engine_store()->find_port(_tail_path);
_head = _engine.engine_store()->find_port(_head_path);
if (_tail == NULL || _head == NULL) {
- _status = PORT_NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PORT_NOT_FOUND);
}
NodeImpl* const src_node = _tail->parent_node();
@@ -155,15 +151,11 @@ Disconnect::pre_process()
assert(_patch);
if (!_patch->has_edge(_tail, _head)) {
- _status = NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(NOT_FOUND);
}
if (src_node == NULL || dst_node == NULL) {
- _status = PARENT_NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PARENT_NOT_FOUND);
}
_impl = new Impl(_engine,
@@ -174,7 +166,7 @@ Disconnect::pre_process()
if (_patch->enabled())
_compiled_patch = _patch->compile();
- Event::pre_process();
+ return Event::pre_process_done(SUCCESS);
}
bool
@@ -208,8 +200,6 @@ Disconnect::Impl::execute(ProcessContext& context, bool set_dst_buffers)
void
Disconnect::execute(ProcessContext& context)
{
- Event::execute(context);
-
if (_status == SUCCESS) {
if (!_impl->execute(context, true)) {
_status = NOT_FOUND;
diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp
index fa17e9f4..68356e84 100644
--- a/src/server/events/Disconnect.hpp
+++ b/src/server/events/Disconnect.hpp
@@ -52,7 +52,7 @@ public:
const Raul::Path& tail_path,
const Raul::Path& head_path);
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();
diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp
index 0a4c2ef1..d9f8b8c1 100644
--- a/src/server/events/DisconnectAll.cpp
+++ b/src/server/events/DisconnectAll.cpp
@@ -79,7 +79,7 @@ DisconnectAll::~DisconnectAll()
delete (*i);
}
-void
+bool
DisconnectAll::pre_process()
{
Glib::RWLock::WriterLock lock(_engine.engine_store()->lock(), Glib::NOT_LOCK);
@@ -88,25 +88,18 @@ DisconnectAll::pre_process()
lock.acquire();
_parent = _engine.engine_store()->find_patch(_parent_path);
-
- if (_parent == NULL) {
- _status = PARENT_NOT_FOUND;
- Event::pre_process();
- return;
+ if (!_parent) {
+ return Event::pre_process_done(PARENT_NOT_FOUND);
}
GraphObjectImpl* object = _engine.engine_store()->find_object(_path);
if (!object) {
- _status = NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(NOT_FOUND);
}
if (object->parent_patch() != _parent
&& object->parent()->parent_patch() != _parent) {
- _status = INVALID_PARENT_PATH;
- Event::pre_process();
- return;
+ return Event::pre_process_done(INVALID_PARENT_PATH);
}
// Only one of these will succeed
@@ -146,14 +139,12 @@ DisconnectAll::pre_process()
if (!_deleting && _parent->enabled())
_compiled_patch = _parent->compile();
- Event::pre_process();
+ return Event::pre_process_done(SUCCESS);
}
void
DisconnectAll::execute(ProcessContext& context)
{
- Event::execute(context);
-
if (_status == SUCCESS) {
for (Impls::iterator i = _impls.begin(); i != _impls.end(); ++i) {
(*i)->execute(context,
diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp
index 9006fd9d..1446d962 100644
--- a/src/server/events/DisconnectAll.hpp
+++ b/src/server/events/DisconnectAll.hpp
@@ -56,7 +56,7 @@ public:
~DisconnectAll();
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index 80fc34e8..6e0aafda 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -48,20 +48,21 @@ Get::Get(Engine& engine,
{
}
-void
+bool
Get::pre_process()
{
_lock.acquire();
if (_uri == "ingen:plugins") {
_plugins = _engine.node_factory()->plugins();
+ return Event::pre_process_done(SUCCESS);
} else if (Raul::Path::is_valid(_uri.str())) {
_object = _engine.engine_store()->find_object(Raul::Path(_uri.str()));
+ return Event::pre_process_done(_object ? SUCCESS : NOT_FOUND);
} else {
_plugin = _engine.node_factory()->plugin(_uri);
+ return Event::pre_process_done(_plugin ? SUCCESS : NOT_FOUND);
}
-
- Event::pre_process();
}
static void
@@ -84,12 +85,9 @@ send_node(Interface* client, const NodeImpl* node)
PluginImpl* const plugin = node->plugin_impl();
if (plugin->type() == Plugin::Patch) {
send_patch(client, (PatchImpl*)node);
- } else if (plugin->uri().length() == 0) {
- Raul::error((Raul::fmt("Node %1%'s plugin has no URI\n")
- % node->path()));
} else {
client->put(node->path(), node->properties());
- for (size_t j=0; j < node->num_ports(); ++j) {
+ for (size_t j = 0; j < node->num_ports(); ++j) {
send_port(client, node->port_impl(j));
}
}
diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp
index 146c2b39..f1b5003d 100644
--- a/src/server/events/Get.hpp
+++ b/src/server/events/Get.hpp
@@ -44,7 +44,8 @@ public:
SampleCount timestamp,
const Raul::URI& uri);
- void pre_process();
+ bool pre_process();
+ void execute(ProcessContext& context) {}
void post_process();
private:
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp
index 3874fcf1..84deba05 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -49,27 +49,22 @@ Move::~Move()
{
}
-void
+bool
Move::pre_process()
{
Glib::RWLock::WriterLock lock(_engine.engine_store()->lock());
if (!_old_path.parent().is_parent_of(_new_path)) {
- _status = PARENT_DIFFERS;
- Event::pre_process();
- return;
+ return Event::pre_process_done(PARENT_DIFFERS);
}
+
_store_iterator = _engine.engine_store()->find(_old_path);
- if (_store_iterator == _engine.engine_store()->end()) {
- _status = NOT_FOUND;
- Event::pre_process();
- return;
+ if (_store_iterator == _engine.engine_store()->end()) {
+ return Event::pre_process_done(NOT_FOUND);
}
- if (_engine.engine_store()->find_object(_new_path)) {
- _status = EXISTS;
- Event::pre_process();
- return;
+ if (_engine.engine_store()->find_object(_new_path)) {
+ return Event::pre_process_done(EXISTS);
}
SharedPtr< Raul::Table< Raul::Path, SharedPtr<GraphObject> > > removed
@@ -93,14 +88,12 @@ Move::pre_process()
_engine.engine_store()->add(*removed.get());
- Event::pre_process();
+ return Event::pre_process_done(SUCCESS);
}
void
Move::execute(ProcessContext& context)
{
- Event::execute(context);
-
SharedPtr<PortImpl> port = PtrCast<PortImpl>(_store_iterator->second);
if (port && port->parent()->parent() == NULL) {
EnginePort* eport = _engine.driver()->engine_port(context, _new_path);
diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp
index 1b35e9bd..2e21b190 100644
--- a/src/server/events/Move.hpp
+++ b/src/server/events/Move.hpp
@@ -53,7 +53,7 @@ public:
~Move();
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();
diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp
index 26757426..7bd3e7a5 100644
--- a/src/server/events/SetMetadata.cpp
+++ b/src/server/events/SetMetadata.cpp
@@ -101,7 +101,7 @@ SetMetadata::~SetMetadata()
delete _create_event;
}
-void
+bool
SetMetadata::pre_process()
{
typedef Properties::const_iterator iterator;
@@ -116,9 +116,7 @@ SetMetadata::pre_process()
: static_cast<Shared::ResourceImpl*>(_engine.node_factory()->plugin(_subject));
if (!_object && (!is_graph_object || !_create)) {
- _status = NOT_FOUND;
- Event::pre_process();
- return;
+ return Event::pre_process_done(NOT_FOUND);
}
const Ingen::Shared::URIs& uris = _engine.world()->uris();
@@ -129,19 +127,15 @@ SetMetadata::pre_process()
Shared::ResourceImpl::type(uris, _properties, is_patch, is_node, is_port, is_output);
if (is_patch) {
- uint32_t poly = 1;
- iterator p = _properties.find(uris.ingen_polyphony);
- if (p != _properties.end() && p->second.is_valid() && p->second.type() == uris.forge.Int)
- poly = p->second.get_int32();
- _create_event = new CreatePatch(_engine, _request_client, _request_id, _time,
- path, poly, _properties);
+ _create_event = new CreatePatch(
+ _engine, _request_client, _request_id, _time, path, _properties);
} else if (is_node) {
- const iterator p = _properties.find(uris.ingen_prototype);
- _create_event = new CreateNode(_engine, _request_client, _request_id, _time,
- path, p->second.get_uri(), _properties);
+ _create_event = new CreateNode(
+ _engine, _request_client, _request_id, _time, path, _properties);
} else if (is_port) {
- _create_event = new CreatePort(_engine, _request_client, _request_id, _time,
- path, is_output, _properties);
+ _create_event = new CreatePort(
+ _engine, _request_client, _request_id, _time,
+ path, is_output, _properties);
}
if (_create_event) {
_create_event->pre_process();
@@ -177,7 +171,7 @@ SetMetadata::pre_process()
_object->remove_property(key, value);
}
- for (Properties::iterator p = _properties.begin(); p != _properties.end(); ++p) {
+ for (Properties::const_iterator p = _properties.begin(); p != _properties.end(); ++p) {
const Raul::URI& key = p->first;
const Resource::Property& value = p->second;
SpecialType op = NONE;
@@ -252,32 +246,34 @@ SetMetadata::pre_process()
}
}
- if (_status != SUCCESS) {
+ if (_status != NOT_PREPARED) {
break;
}
_types.push_back(op);
}
- Event::pre_process();
+ return Event::pre_process_done(_status == NOT_PREPARED ? SUCCESS : _status);
}
void
SetMetadata::execute(ProcessContext& context)
{
- if (_status != SUCCESS) {
- Event::execute(context);
+ if (_status) {
return;
}
const Ingen::Shared::URIs& uris = _engine.world()->uris();
if (_create_event) {
+ _create_event->set_time(_time);
_create_event->execute(context);
}
- for (SetEvents::iterator i = _set_events.begin(); i != _set_events.end(); ++i)
+ for (SetEvents::iterator i = _set_events.begin(); i != _set_events.end(); ++i) {
+ (*i)->set_time(_time);
(*i)->execute(context);
+ }
GraphObjectImpl* const object = dynamic_cast<GraphObjectImpl*>(_object);
NodeImpl* const node = dynamic_cast<NodeImpl*>(_object);
@@ -289,8 +285,9 @@ SetMetadata::execute(ProcessContext& context)
const Raul::Atom& value = p->second;
switch (*t) {
case ENABLE_BROADCAST:
- if (port)
+ if (port) {
port->broadcast(value.get_bool());
+ }
break;
case ENABLE:
if (value.get_bool()) {
@@ -303,15 +300,14 @@ SetMetadata::execute(ProcessContext& context)
_patch->disable(context);
}
break;
- case POLYPHONIC:
- {
- PatchImpl* parent = reinterpret_cast<PatchImpl*>(object->parent());
- if (value.get_bool())
- object->apply_poly(context, *_engine.maid(), parent->internal_poly());
- else
- object->apply_poly(context, *_engine.maid(), 1);
+ case POLYPHONIC: {
+ PatchImpl* parent = reinterpret_cast<PatchImpl*>(object->parent());
+ if (value.get_bool()) {
+ object->apply_poly(context, *_engine.maid(), parent->internal_poly());
+ } else {
+ object->apply_poly(context, *_engine.maid(), 1);
}
- break;
+ } break;
case POLYPHONY:
if (_patch->internal_poly() != static_cast<uint32_t>(value.get_int32()) &&
!_patch->apply_internal_poly(context,
@@ -340,8 +336,6 @@ SetMetadata::execute(ProcessContext& context)
break;
}
}
-
- Event::execute(context);
}
void
diff --git a/src/server/events/SetMetadata.hpp b/src/server/events/SetMetadata.hpp
index 84957e02..223339da 100644
--- a/src/server/events/SetMetadata.hpp
+++ b/src/server/events/SetMetadata.hpp
@@ -78,7 +78,7 @@ public:
~SetMetadata();
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index b4b26ccf..9eb57d55 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -69,19 +69,20 @@ SetPortValue::~SetPortValue()
{
}
-void
+bool
SetPortValue::pre_process()
{
- if (_queued) {
- if (_port == NULL)
- _port = _engine.engine_store()->find_port(_port_path);
- if (_port == NULL)
- _status = PORT_NOT_FOUND;
+ if (_queued && !_port) {
+ _port = _engine.engine_store()->find_port(_port_path);
+ }
+
+ if (!_port) {
+ return Event::pre_process_done(PORT_NOT_FOUND);
}
// Port is a message context port, set its value and
// call the plugin's message run function once
- if (_port && _port->parent_node()->context() == Context::MESSAGE) {
+ if (_port->parent_node()->context() == Context::MESSAGE) {
apply(_engine.message_context());
_engine.message_context().run(
_engine.message_context(),
@@ -89,20 +90,18 @@ SetPortValue::pre_process()
_engine.driver()->frame_time() + _engine.driver()->block_length());
}
- if (_port) {
- _port->set_value(_value);
- _port->set_property(_engine.world()->uris().ingen_value, _value);
- }
+ // Set value metadata (does not affect buffers)
+ _port->set_value(_value);
+ _port->set_property(_engine.world()->uris().ingen_value, _value);
_binding = _engine.control_bindings()->port_binding(_port);
- Event::pre_process();
+ return Event::pre_process_done(SUCCESS);
}
void
SetPortValue::execute(ProcessContext& context)
{
- Event::execute(context);
assert(_time >= context.start() && _time <= context.end());
if (_port && _port->parent_node()->context() == Context::MESSAGE)
diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp
index a6166060..4d97ee99 100644
--- a/src/server/events/SetPortValue.hpp
+++ b/src/server/events/SetPortValue.hpp
@@ -59,7 +59,7 @@ public:
~SetPortValue();
- void pre_process();
+ bool pre_process();
void execute(ProcessContext& context);
void post_process();