summaryrefslogtreecommitdiffstats
path: root/src/engine/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/events')
-rw-r--r--src/engine/events/CreateNodeEvent.cpp2
-rw-r--r--src/engine/events/CreatePatchEvent.cpp4
-rw-r--r--src/engine/events/CreatePortEvent.cpp7
-rw-r--r--src/engine/events/RequestMetadataEvent.cpp21
-rw-r--r--src/engine/events/RequestMetadataEvent.hpp4
-rw-r--r--src/engine/events/SetMetadataEvent.cpp77
-rw-r--r--src/engine/events/SetMetadataEvent.hpp6
7 files changed, 67 insertions, 54 deletions
diff --git a/src/engine/events/CreateNodeEvent.cpp b/src/engine/events/CreateNodeEvent.cpp
index 6f3ed834..718a94a3 100644
--- a/src/engine/events/CreateNodeEvent.cpp
+++ b/src/engine/events/CreateNodeEvent.cpp
@@ -89,7 +89,7 @@ CreateNodeEvent::pre_process()
if (_patch && plugin) {
_node = plugin->instantiate(_path.name(), _polyphonic, _patch, _engine);
- _node->variables().insert(_properties.begin(), _properties.end());
+ _node->properties().insert(_properties.begin(), _properties.end());
if (_node != NULL) {
_node->activate();
diff --git a/src/engine/events/CreatePatchEvent.cpp b/src/engine/events/CreatePatchEvent.cpp
index f4a60760..16f749a3 100644
--- a/src/engine/events/CreatePatchEvent.cpp
+++ b/src/engine/events/CreatePatchEvent.cpp
@@ -83,7 +83,9 @@ CreatePatchEvent::pre_process()
poly = _poly;
_patch = new PatchImpl(_engine, path.name(), poly, _parent, _engine.audio_driver()->sample_rate(), _engine.audio_driver()->buffer_size(), _poly);
- _patch->properties().insert(_properties.begin(), _properties.end());
+ _patch->meta().properties().insert(_properties.begin(), _properties.end());
+ _patch->set_property("rdf:type", Atom(Atom::URI, "ingen:Node"));
+ _patch->set_property("rdf:instanceOf", Atom(Atom::URI, _patch->meta_uri().str()));
if (_parent != NULL) {
_parent->add_node(new PatchImpl::Nodes::Node(_patch));
diff --git a/src/engine/events/CreatePortEvent.cpp b/src/engine/events/CreatePortEvent.cpp
index 38c3587c..e954c56d 100644
--- a/src/engine/events/CreatePortEvent.cpp
+++ b/src/engine/events/CreatePortEvent.cpp
@@ -15,10 +15,11 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "raul/Path.hpp"
#include "raul/Array.hpp"
+#include "raul/Atom.hpp"
#include "raul/List.hpp"
#include "raul/Maid.hpp"
+#include "raul/Path.hpp"
#include "Responder.hpp"
#include "CreatePortEvent.hpp"
#include "PatchImpl.hpp"
@@ -35,6 +36,7 @@
#include "DuplexPort.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -96,7 +98,8 @@ CreatePortEvent::pre_process()
const uint32_t old_num_ports = _patch->num_ports();
_patch_port = _patch->create_port(_path.name(), _data_type, buffer_size, _is_output);
- _patch_port->properties().insert(_properties.begin(), _properties.end());
+ _patch_port->set_property("rdf:instanceOf", Atom(Atom::URI, _patch_port->meta_uri().str()));
+ _patch_port->meta().properties().insert(_properties.begin(), _properties.end());
if (_patch_port) {
diff --git a/src/engine/events/RequestMetadataEvent.cpp b/src/engine/events/RequestMetadataEvent.cpp
index fe1f0cab..5d0b15bc 100644
--- a/src/engine/events/RequestMetadataEvent.cpp
+++ b/src/engine/events/RequestMetadataEvent.cpp
@@ -37,7 +37,7 @@ using namespace Shared;
RequestMetadataEvent::RequestMetadataEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- bool is_property,
+ bool is_meta,
const URI& subject,
const URI& key)
: QueuedEvent(engine, responder, timestamp)
@@ -46,7 +46,7 @@ RequestMetadataEvent::RequestMetadataEvent(Engine& engine,
, _uri(subject)
, _key(key)
, _resource(0)
- , _is_property(is_property)
+ , _is_meta(is_meta)
{
}
@@ -67,12 +67,17 @@ RequestMetadataEvent::pre_process()
}
}
- if (_key.str() == "ingen:value")
- _special_type = PORT_VALUE;
- else if (!is_object || _is_property)
+ GraphObjectImpl* obj = dynamic_cast<GraphObjectImpl*>(_resource);
+ if (obj) {
+ if (_key.str() == "ingen:value")
+ _special_type = PORT_VALUE;
+ else if (_is_meta)
+ _value = obj->meta().get_property(_key);
+ else
+ _value = obj->get_property(_key);
+ } else {
_value = _resource->get_property(_key);
- else
- _value = dynamic_cast<GraphObjectImpl*>(_resource)->get_variable(_key);
+ }
QueuedEvent::pre_process();
}
@@ -111,7 +116,7 @@ RequestMetadataEvent::post_process()
_responder->respond_error(msg);
} else {
_responder->respond_ok();
- _responder->client()->set_variable(_uri, _key, _value);
+ _responder->client()->set_property(_uri, _key, _value);
}
} else {
_responder->respond_error("Unknown client");
diff --git a/src/engine/events/RequestMetadataEvent.hpp b/src/engine/events/RequestMetadataEvent.hpp
index 1445f83d..9d1c6bf0 100644
--- a/src/engine/events/RequestMetadataEvent.hpp
+++ b/src/engine/events/RequestMetadataEvent.hpp
@@ -39,7 +39,7 @@ public:
RequestMetadataEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- bool property,
+ bool meta,
const Raul::URI& path,
const Raul::URI& key);
@@ -58,7 +58,7 @@ private:
Raul::URI _key;
Raul::Atom _value;
Shared::ResourceImpl* _resource;
- bool _is_property;
+ bool _is_meta;
};
diff --git a/src/engine/events/SetMetadataEvent.cpp b/src/engine/events/SetMetadataEvent.cpp
index af36b5d3..482656ca 100644
--- a/src/engine/events/SetMetadataEvent.cpp
+++ b/src/engine/events/SetMetadataEvent.cpp
@@ -37,20 +37,21 @@ SetMetadataEvent::SetMetadataEvent(
Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- bool property,
+ bool meta,
const URI& subject,
const URI& key,
const Atom& value)
: QueuedEvent(engine, responder, timestamp)
, _error(NO_ERROR)
, _special_type(NONE)
- , _property(property)
, _subject(subject)
, _key(key)
, _value(value)
, _object(NULL)
, _patch(NULL)
, _compiled_patch(NULL)
+ , _is_meta(meta)
+ , _success(false)
{
}
@@ -70,40 +71,45 @@ SetMetadataEvent::pre_process()
}
/*cerr << "SET " << _object->path() << (_property ? " PROP " : " VAR ")
- << _key << " :: " << _value.type() << endl;*/
+ << _key << " :: " << _value.type() << endl;*/
- if (_property || !dynamic_cast<GraphObjectImpl*>(_object))
- _object->set_property(_key, _value);
- else
- dynamic_cast<GraphObjectImpl*>(_object)->set_variable(_key, _value);
-
- _patch = dynamic_cast<PatchImpl*>(_object);
-
- if (_key.str() == "ingen:broadcast") {
- _special_type = ENABLE_BROADCAST;
- } else if (_patch) {
- if (!_property && _key.str() == "ingen:enabled") {
- if (_value.type() == Atom::BOOL) {
- _special_type = ENABLE;
- if (_value.get_bool() && !_patch->compiled_patch())
- _compiled_patch = _patch->compile();
- } else {
- _error = BAD_TYPE;
- }
- } else if (!_property && _key.str() == "ingen:polyphonic") {
- if (_value.type() == Atom::BOOL) {
- _special_type = POLYPHONIC;
- } else {
- _error = BAD_TYPE;
- }
- } else if (_property && _key.str() == "ingen:polyphony") {
- if (_value.type() == Atom::INT) {
- _special_type = POLYPHONY;
- _patch->prepare_internal_poly(_value.get_int32());
- } else {
- _error = BAD_TYPE;
+ GraphObjectImpl* obj = dynamic_cast<GraphObjectImpl*>(_object);
+ if (obj) {
+ if (_is_meta)
+ obj->meta().set_property(_key, _value);
+ else
+ obj->set_property(_key, _value);
+
+ _patch = dynamic_cast<PatchImpl*>(_object);
+
+ if (_key.str() == "ingen:broadcast") {
+ _special_type = ENABLE_BROADCAST;
+ } else if (_patch) {
+ if (_key.str() == "ingen:enabled") {
+ if (_value.type() == Atom::BOOL) {
+ _special_type = ENABLE;
+ if (_value.get_bool() && !_patch->compiled_patch())
+ _compiled_patch = _patch->compile();
+ } else {
+ _error = BAD_TYPE;
+ }
+ } else if (_key.str() == "ingen:polyphonic") {
+ if (_value.type() == Atom::BOOL) {
+ _special_type = POLYPHONIC;
+ } else {
+ _error = BAD_TYPE;
+ }
+ } else if (_key.str() == "ingen:polyphony") {
+ if (_value.type() == Atom::INT) {
+ _special_type = POLYPHONY;
+ _patch->prepare_internal_poly(_value.get_int32());
+ } else {
+ _error = BAD_TYPE;
+ }
}
}
+ } else {
+ _object->set_property(_key, _value);
}
QueuedEvent::pre_process();
@@ -155,10 +161,7 @@ SetMetadataEvent::post_process()
switch (_error) {
case NO_ERROR:
_responder->respond_ok();
- if (_property)
- _engine.broadcaster()->send_property_change(_subject, _key, _value);
- else
- _engine.broadcaster()->send_variable_change(_subject, _key, _value);
+ _engine.broadcaster()->send_property_change(_subject, _key, _value);
break;
case NOT_FOUND:
_responder->respond_error((boost::format(
diff --git a/src/engine/events/SetMetadataEvent.hpp b/src/engine/events/SetMetadataEvent.hpp
index 944091b0..b33cc9ca 100644
--- a/src/engine/events/SetMetadataEvent.hpp
+++ b/src/engine/events/SetMetadataEvent.hpp
@@ -40,7 +40,7 @@ public:
SetMetadataEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
- bool property,
+ bool meta,
const Raul::URI& subject,
const Raul::URI& key,
const Raul::Atom& value);
@@ -59,14 +59,14 @@ private:
POLYPHONIC
} _special_type;
- bool _property;
- bool _success;
Raul::URI _subject;
Raul::URI _key;
Raul::Atom _value;
Shared::ResourceImpl* _object;
PatchImpl* _patch;
CompiledPatch* _compiled_patch;
+ bool _is_meta;
+ bool _success;
};