summaryrefslogtreecommitdiffstats
path: root/src/engine/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/events')
-rw-r--r--src/engine/events/CreateNode.cpp2
-rw-r--r--src/engine/events/CreatePatch.cpp9
-rw-r--r--src/engine/events/CreatePort.cpp9
-rw-r--r--src/engine/events/Delete.cpp4
-rw-r--r--src/engine/events/RequestMetadata.cpp6
-rw-r--r--src/engine/events/SendPortValue.cpp4
-rw-r--r--src/engine/events/SetMetadata.cpp28
-rw-r--r--src/engine/events/SetPortValue.cpp12
8 files changed, 42 insertions, 32 deletions
diff --git a/src/engine/events/CreateNode.cpp b/src/engine/events/CreateNode.cpp
index bc43620d..7dabd65d 100644
--- a/src/engine/events/CreateNode.cpp
+++ b/src/engine/events/CreateNode.cpp
@@ -90,7 +90,7 @@ CreateNode::pre_process()
if (_patch && _plugin) {
- _node = _plugin->instantiate(*_engine.buffer_factory(), _path.name(), _polyphonic, _patch, _engine);
+ _node = _plugin->instantiate(*_engine.buffer_factory(), _path.symbol(), _polyphonic, _patch, _engine);
if (_node != NULL) {
_node->properties().insert(_properties.begin(), _properties.end());
diff --git a/src/engine/events/CreatePatch.cpp b/src/engine/events/CreatePatch.cpp
index b76efcdc..5d72f13a 100644
--- a/src/engine/events/CreatePatch.cpp
+++ b/src/engine/events/CreatePatch.cpp
@@ -17,6 +17,7 @@
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
+#include "shared/LV2URIMap.hpp"
#include "events/CreatePatch.hpp"
#include "Responder.hpp"
#include "PatchImpl.hpp"
@@ -83,11 +84,13 @@ CreatePatch::pre_process()
if (_parent != NULL && _poly > 1 && _poly == static_cast<int>(_parent->internal_polyphony()))
poly = _poly;
- _patch = new PatchImpl(_engine, path.name(), poly, _parent,
+ const LV2URIMap& uris = *_engine.world()->uris.get();
+
+ _patch = new PatchImpl(_engine, path.symbol(), poly, _parent,
_engine.driver()->sample_rate(), _engine.driver()->buffer_size(), _poly);
_patch->meta().properties().insert(_properties.begin(), _properties.end());
- _patch->meta().set_property("rdf:type", Atom(Atom::URI, "ingen:Patch"));
- _patch->set_property("rdf:type", Atom(Atom::URI, "ingen:Node"));
+ _patch->meta().set_property(uris.rdf_type, uris.ingen_Patch);
+ _patch->set_property(uris.rdf_type, uris.ingen_Node);
if (_parent != NULL) {
_parent->add_node(new PatchImpl::Nodes::Node(_patch));
diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp
index 73ba4b83..44ffe90d 100644
--- a/src/engine/events/CreatePort.cpp
+++ b/src/engine/events/CreatePort.cpp
@@ -88,16 +88,13 @@ CreatePort::pre_process()
if (_patch != NULL) {
assert(_patch->path() == _path.parent());
- size_t buffer_size = 1;
- if (_type.str() != "ingen:Float")
- buffer_size = _engine.driver()->buffer_size();
+ size_t buffer_size = _engine.driver()->buffer_size();
const uint32_t old_num_ports = _patch->num_ports();
- _patch_port = _patch->create_port(*_engine.buffer_factory(), _path.name(), _data_type, buffer_size, _is_output);
+ _patch_port = _patch->create_port(*_engine.buffer_factory(), _path.symbol(), _data_type, buffer_size, _is_output);
if (_patch->parent())
- _patch_port->set_property("rdf:instanceOf",
- Atom(Atom::URI, _patch_port->meta_uri().str()));
+ _patch_port->set_property("rdf:instanceOf", _patch_port->meta_uri());
_patch_port->meta().properties().insert(_properties.begin(), _properties.end());
diff --git a/src/engine/events/Delete.cpp b/src/engine/events/Delete.cpp
index 11d355a4..30166c51 100644
--- a/src/engine/events/Delete.cpp
+++ b/src/engine/events/Delete.cpp
@@ -80,7 +80,7 @@ Delete::pre_process()
if (_node && !_path.is_root()) {
assert(_node->parent_patch());
- _patch_node_listnode = _node->parent_patch()->remove_node(_path.name());
+ _patch_node_listnode = _node->parent_patch()->remove_node(_path.symbol());
if (_patch_node_listnode) {
assert(_patch_node_listnode->elem() == _node.get());
@@ -101,7 +101,7 @@ Delete::pre_process()
}
} else if (_port) {
assert(_port->parent_patch());
- _patch_port_listnode = _port->parent_patch()->remove_port(_path.name());
+ _patch_port_listnode = _port->parent_patch()->remove_port(_path.symbol());
if (_patch_port_listnode) {
assert(_patch_port_listnode->elem() == _port.get());
diff --git a/src/engine/events/RequestMetadata.cpp b/src/engine/events/RequestMetadata.cpp
index c773ae3d..1cc092e2 100644
--- a/src/engine/events/RequestMetadata.cpp
+++ b/src/engine/events/RequestMetadata.cpp
@@ -18,6 +18,7 @@
#include "interface/ClientInterface.hpp"
#include "events/RequestMetadata.hpp"
#include "shared/LV2Object.hpp"
+#include "shared/LV2URIMap.hpp"
#include "AudioBuffer.hpp"
#include "ClientBroadcaster.hpp"
#include "Engine.hpp"
@@ -73,7 +74,7 @@ RequestMetadata::pre_process()
GraphObjectImpl* obj = dynamic_cast<GraphObjectImpl*>(_resource);
if (obj) {
- if (_key.str() == "ingen:value")
+ if (_key == _engine.world()->uris->ingen_value)
_special_type = PORT_VALUE;
else if (_is_meta)
_value = obj->meta().get_property(_key);
@@ -113,7 +114,8 @@ RequestMetadata::post_process()
if (_special_type == PORT_VALUE) {
if (_resource) {
_responder->respond_ok();
- _responder->client()->set_property(_uri.str(), "ingen:value", _value);
+ _responder->client()->set_property(_uri.str(),
+ _engine.world()->uris->ingen_value, _value);
} else {
const string msg = "Get value for non-port " + _uri.str();
_responder->respond_error(msg);
diff --git a/src/engine/events/SendPortValue.cpp b/src/engine/events/SendPortValue.cpp
index 52592d81..1d7d400d 100644
--- a/src/engine/events/SendPortValue.cpp
+++ b/src/engine/events/SendPortValue.cpp
@@ -17,6 +17,7 @@
#include <sstream>
#include "events/SendPortValue.hpp"
+#include "shared/LV2URIMap.hpp"
#include "Engine.hpp"
#include "PortImpl.hpp"
#include "ClientBroadcaster.hpp"
@@ -31,7 +32,8 @@ void
SendPortValue::post_process()
{
if (_omni) {
- _engine.broadcaster()->set_property(_port->path(), "ingen:value", _value);
+ _engine.broadcaster()->set_property(_port->path(),
+ _engine.world()->uris->ingen_value, _value);
} else {
_engine.broadcaster()->set_voice_value(_port->path(), _voice_num, _value);
}
diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp
index ae69aecf..85768b3d 100644
--- a/src/engine/events/SetMetadata.cpp
+++ b/src/engine/events/SetMetadata.cpp
@@ -19,6 +19,7 @@
#include <boost/format.hpp>
#include "raul/log.hpp"
#include "interface/PortType.hpp"
+#include "shared/LV2URIMap.hpp"
#include "ClientBroadcaster.hpp"
#include "CreateNode.hpp"
#include "CreatePatch.hpp"
@@ -92,6 +93,8 @@ SetMetadata::pre_process()
return;
}
+ const LV2URIMap& uris = *_engine.world()->uris.get();
+
if (is_graph_object && !_object) {
Path path(_subject.str());
bool is_patch = false, is_node = false, is_port = false, is_output = false;
@@ -99,13 +102,13 @@ SetMetadata::pre_process()
ResourceImpl::type(_properties, is_patch, is_node, is_port, is_output, data_type);
if (is_patch) {
uint32_t poly = 1;
- iterator p = _properties.find("ingen:polyphony");
+ iterator p = _properties.find(uris.ingen_polyphony);
if (p != _properties.end() && p->second.is_valid() && p->second.type() == Atom::INT)
poly = p->second.get_int32();
_create_event = new CreatePatch(_engine, _responder, _time,
path, poly, _properties);
} else if (is_node) {
- const iterator p = _properties.find("rdf:instanceOf");
+ const iterator p = _properties.find(uris.rdf_instanceOf);
_create_event = new CreateNode(_engine, _responder, _time,
path, p->second.get_uri(), true, _properties);
} else if (is_port) {
@@ -143,10 +146,13 @@ SetMetadata::pre_process()
_patch = dynamic_cast<PatchImpl*>(_object);
- if (key.str() == "ingen:broadcast") {
- op = ENABLE_BROADCAST;
+ if (key == uris.ingen_broadcast) {
+ if (value.type() == Atom::BOOL)
+ op = ENABLE_BROADCAST;
+ else
+ _error = BAD_VALUE_TYPE;
} else if (_patch) {
- if (key.str() == "ingen:enabled") {
+ if (key == uris.ingen_enabled) {
if (value.type() == Atom::BOOL) {
op = ENABLE;
if (value.get_bool() && !_patch->compiled_patch())
@@ -154,13 +160,13 @@ SetMetadata::pre_process()
} else {
_error = BAD_VALUE_TYPE;
}
- } else if (key.str() == "ingen:polyphonic") {
+ } else if (key == uris.ingen_polyphonic) {
if (value.type() == Atom::BOOL) {
op = POLYPHONIC;
} else {
_error = BAD_VALUE_TYPE;
}
- } else if (key.str() == "ingen:polyphony") {
+ } else if (key == uris.ingen_polyphony) {
if (value.type() == Atom::INT) {
op = POLYPHONY;
_patch->prepare_internal_poly(*_engine.buffer_factory(), value.get_int32());
@@ -168,7 +174,7 @@ SetMetadata::pre_process()
_error = BAD_VALUE_TYPE;
}
}
- } else if (key.str() == "ingen:value") {
+ } else if (key == uris.ingen_value) {
PortImpl* port = dynamic_cast<PortImpl*>(_object);
if (port) {
SetPortValue* ev = new SetPortValue(_engine, _responder, _time, port, value);
@@ -263,17 +269,17 @@ SetMetadata::post_process()
break;
case NOT_FOUND:
_responder->respond_error((boost::format(
- "Unable to find object '%1%'") % _subject).str());
+ "Unable to find object `%1%'") % _subject).str());
case INTERNAL:
_responder->respond_error("Internal error");
break;
case BAD_OBJECT_TYPE:
_responder->respond_error((boost::format(
- "Bad type for object '%1%'") % _subject).str());
+ "Bad type for object `%1%'") % _subject).str());
break;
case BAD_VALUE_TYPE:
_responder->respond_error((boost::format(
- "Bad metadata value type for subject '%1%' predicate '%2%")
+ "Bad metadata value type for subject `%1%' predicate `%2%'")
% _subject % _error_predicate).str());
break;
}
diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp
index f1abc720..0ec5d98b 100644
--- a/src/engine/events/SetPortValue.cpp
+++ b/src/engine/events/SetPortValue.cpp
@@ -126,7 +126,7 @@ SetPortValue::pre_process()
if (_port) {
_port->set_value(_value);
- _port->set_property("ingen:value", _value);
+ _port->set_property(_engine.world()->uris->ingen_value, _value);
}
QueuedEvent::pre_process();
@@ -181,8 +181,7 @@ SetPortValue::apply(Context& context)
return;
}
- SharedPtr<LV2URIMap> map = PtrCast<LV2URIMap>(
- _engine.world()->lv2_features->feature(LV2_URI_MAP_URI));
+ SharedPtr<LV2URIMap> uris = _engine.world()->uris;
EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf);
if (ebuf) {
@@ -190,14 +189,14 @@ SetPortValue::apply(Context& context)
// Size 0 event, pass it along to the plugin as a typed but empty event
if (_value.data_size() == 0) {
- const uint32_t type_id = map->uri_to_id(NULL, _value.get_blob_type());
+ const uint32_t type_id = uris->uri_to_id(NULL, _value.get_blob_type());
ebuf->append(frames, 0, type_id, 0, NULL);
_port->raise_set_by_user_flag();
return;
} else if (!strcmp(_value.get_blob_type(), "lv2midi:MidiEvent")) {
ebuf->prepare_write(context);
- ebuf->append(frames, 0, map->midi_event, _value.data_size(),
+ ebuf->append(frames, 0, uris->midi_event.id, _value.data_size(),
(const uint8_t*)_value.get_blob());
_port->raise_set_by_user_flag();
return;
@@ -231,7 +230,8 @@ SetPortValue::post_process()
assert(_port != NULL);
_responder->respond_ok();
if (_omni)
- _engine.broadcaster()->set_property(_port_path, "ingen:value", _value);
+ _engine.broadcaster()->set_property(_port_path,
+ _engine.world()->uris->ingen_value, _value);
else
_engine.broadcaster()->set_voice_value(_port_path, _voice_num, _value);
break;