summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/ClientStore.cpp11
-rw-r--r--src/client/DeprecatedLoader.cpp6
-rw-r--r--src/client/HTTPClientReceiver.cpp2
-rw-r--r--src/client/NodeModel.cpp9
-rw-r--r--src/client/NodeModel.hpp13
-rw-r--r--src/client/ObjectModel.cpp11
-rw-r--r--src/client/ObjectModel.hpp12
-rw-r--r--src/client/PatchModel.cpp8
-rw-r--r--src/client/PluginModel.cpp22
-rw-r--r--src/client/PluginUI.cpp15
-rw-r--r--src/client/PortModel.cpp17
-rw-r--r--src/client/PortModel.hpp13
-rw-r--r--src/common/interface/GraphObject.hpp6
-rw-r--r--src/common/interface/Resource.hpp2
-rw-r--r--src/engine/BufferFactory.cpp6
-rw-r--r--src/engine/ControlBindings.cpp4
-rw-r--r--src/engine/Engine.cpp18
-rw-r--r--src/engine/GraphObjectImpl.cpp9
-rw-r--r--src/engine/GraphObjectImpl.hpp25
-rw-r--r--src/engine/HTTPEngineReceiver.cpp2
-rw-r--r--src/engine/InternalPlugin.cpp9
-rw-r--r--src/engine/JackDriver.cpp5
-rw-r--r--src/engine/LADSPAPlugin.cpp13
-rw-r--r--src/engine/LV2Plugin.cpp6
-rw-r--r--src/engine/NodeBase.cpp4
-rw-r--r--src/engine/NodeBase.hpp12
-rw-r--r--src/engine/NodeImpl.hpp4
-rw-r--r--src/engine/ObjectSender.cpp8
-rw-r--r--src/engine/ObjectSender.hpp2
-rw-r--r--src/engine/PatchImpl.cpp6
-rw-r--r--src/engine/PatchImpl.hpp16
-rw-r--r--src/engine/PortImpl.cpp13
-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
-rw-r--r--src/gui/App.hpp3
-rw-r--r--src/gui/BreadCrumbs.hpp2
-rw-r--r--src/gui/ControlPanel.cpp9
-rw-r--r--src/gui/Controls.cpp12
-rw-r--r--src/gui/LoadPatchWindow.cpp9
-rw-r--r--src/gui/LoadPluginWindow.cpp15
-rw-r--r--src/gui/LoadSubpatchWindow.cpp15
-rw-r--r--src/gui/NewSubpatchWindow.cpp12
-rw-r--r--src/gui/NodeControlWindow.cpp4
-rw-r--r--src/gui/NodeMenu.cpp6
-rw-r--r--src/gui/NodeModule.cpp56
-rw-r--r--src/gui/ObjectMenu.cpp9
-rw-r--r--src/gui/PatchCanvas.cpp43
-rw-r--r--src/gui/PatchCanvas.hpp2
-rw-r--r--src/gui/PatchPortModule.cpp44
-rw-r--r--src/gui/PatchPortModule.hpp2
-rw-r--r--src/gui/PatchTreeWindow.cpp13
-rw-r--r--src/gui/PatchView.cpp9
-rw-r--r--src/gui/Port.cpp50
-rw-r--r--src/gui/Port.hpp14
-rw-r--r--src/gui/PortMenu.cpp17
-rw-r--r--src/gui/PortPropertiesWindow.cpp11
-rw-r--r--src/gui/RenameWindow.cpp23
-rw-r--r--src/gui/UploadPatchWindow.cpp4
-rw-r--r--src/ingen/main.cpp2
-rw-r--r--src/module/World.hpp3
-rw-r--r--src/module/ingen_module.cpp9
-rw-r--r--src/serialisation/Parser.cpp15
-rw-r--r--src/serialisation/Serialiser.cpp15
-rw-r--r--src/serialisation/Serialiser.hpp2
-rw-r--r--src/shared/Builder.cpp14
-rw-r--r--src/shared/ClashAvoider.cpp8
-rw-r--r--src/shared/LV2Features.cpp3
-rw-r--r--src/shared/LV2Features.hpp8
-rw-r--r--src/shared/LV2Object.cpp22
-rw-r--r--src/shared/LV2URIMap.cpp51
-rw-r--r--src/shared/LV2URIMap.hpp59
-rw-r--r--src/shared/ResourceImpl.hpp4
78 files changed, 586 insertions, 396 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index 762bb2e6..eb42f6a9 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -313,9 +313,14 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties)
} else if (is_port) {
if (data_type != PortType::UNKNOWN) {
PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT;
- SharedPtr<PortModel> p(new PortModel(path, 0, data_type, pdir));
- p->set_properties(properties);
- add_object(p);
+ const Resource::Properties::const_iterator i = properties.find("lv2:index");
+ if (i != properties.end() && i->second.type() == Atom::INT) {
+ SharedPtr<PortModel> p(new PortModel(path, i->second.get_int32(), data_type, pdir));
+ p->set_properties(properties);
+ add_object(p);
+ } else {
+ LOG(error) << "Port " << path << " has no index" << endl;
+ }
} else {
LOG(warn) << "Port " << path << " has no type" << endl;
}
diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp
index 9af1a781..ec603760 100644
--- a/src/client/DeprecatedLoader.cpp
+++ b/src/client/DeprecatedLoader.cpp
@@ -174,7 +174,7 @@ DeprecatedLoader::add_variable(GraphObject::Properties& data, string old_key, st
if (endptr != c_val && *endptr == '\0')
data.insert(make_pair(key, Atom(fval)));
else
- data.insert(make_pair(key, Atom(Atom::STRING, value)));
+ data.insert(make_pair(key, value));
free(c_val);
}
@@ -210,7 +210,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
bool merge,
boost::optional<Path> parent_path,
boost::optional<Symbol> name,
- GraphObject::Properties initial_data,
+ GraphObject::Properties initial_data,
bool existing)
{
LOG(info) << "Loading patch " << filename << " under "
@@ -220,7 +220,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
if (parent_path)
path = *parent_path;
if (name)
- path = path.base() + *name;
+ path = path.child(*name);
size_t poly = 0;
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index 308b631b..c4eb2416 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -181,7 +181,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi
return;
}
- if (path == Path::root_uri) {
+ if (path == Path::root.str()) {
me->_target->response_ok(0);
} else if (path == "/plugins") {
diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp
index ea419e3a..df72c9e2 100644
--- a/src/client/NodeModel.cpp
+++ b/src/client/NodeModel.cpp
@@ -119,7 +119,7 @@ NodeModel::add_child(SharedPtr<ObjectModel> c)
bool
NodeModel::remove_child(SharedPtr<ObjectModel> c)
{
- assert(c->path().is_child_of(_path));
+ assert(c->path().is_child_of(path()));
assert(c->parent().get() == this);
//bool ret = ObjectModel::remove_child(c);
@@ -137,7 +137,7 @@ void
NodeModel::add_port(SharedPtr<PortModel> pm)
{
assert(pm);
- assert(pm->path().is_child_of(_path));
+ assert(pm->path().is_child_of(path()));
assert(pm->parent().get() == this);
Ports::iterator existing = find(_ports.begin(), _ports.end(), pm);
@@ -151,11 +151,10 @@ NodeModel::add_port(SharedPtr<PortModel> pm)
SharedPtr<PortModel>
-NodeModel::get_port(const string& port_name) const
+NodeModel::get_port(const Raul::Symbol& symbol) const
{
- assert(port_name.find("/") == string::npos);
for (Ports::const_iterator i = _ports.begin(); i != _ports.end(); ++i)
- if ((*i)->path().name() == port_name)
+ if ((*i)->symbol() == symbol)
return (*i);
return SharedPtr<PortModel>();
}
diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp
index 3b0877d1..c1eb91e7 100644
--- a/src/client/NodeModel.hpp
+++ b/src/client/NodeModel.hpp
@@ -50,15 +50,16 @@ public:
typedef std::vector< SharedPtr<PortModel> > Ports;
- SharedPtr<PortModel> get_port(const std::string& port_name) const;
+ SharedPtr<PortModel> get_port(const Raul::Symbol& symbol) const;
Shared::Port* port(uint32_t index) const;
- const Raul::URI& plugin_uri() const { return _plugin_uri; }
- const Shared::Plugin* plugin() const { return _plugin.get(); }
- Shared::Plugin* plugin() { return _plugin.get(); }
- uint32_t num_ports() const { return _ports.size(); }
- const Ports& ports() const { return _ports; }
+ const Raul::URI& plugin_uri() const { return _plugin_uri; }
+ const Shared::Plugin* plugin() const { return _plugin.get(); }
+ Shared::Plugin* plugin() { return _plugin.get(); }
+ SharedPtr<PluginModel> plugin_model() const { return _plugin; }
+ uint32_t num_ports() const { return _ports.size(); }
+ const Ports& ports() const { return _ports; }
void default_port_value_range(SharedPtr<PortModel> port, float& min, float& max) const;
void port_value_range(SharedPtr<PortModel> port, float& min, float& max) const;
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index 7949f316..69d79d1e 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -17,6 +17,9 @@
#include "raul/TableImpl.hpp"
#include "interface/GraphObject.hpp"
+#include "module/ingen_module.hpp"
+#include "module/World.hpp"
+#include "shared/LV2URIMap.hpp"
#include "ObjectModel.hpp"
using namespace std;
@@ -30,6 +33,7 @@ ObjectModel::ObjectModel(const Path& path)
: ResourceImpl(path)
, _meta(ResourceImpl::meta_uri(path))
, _path(path)
+ , _symbol((path == Path::root) ? "root" : path.symbol())
{
}
@@ -74,7 +78,7 @@ ObjectModel::get_property(const Raul::URI& key) const
bool
ObjectModel::polyphonic() const
{
- const Raul::Atom& polyphonic = get_property("ingen:polyphonic");
+ const Raul::Atom& polyphonic = get_property(ingen_get_world()->uris->ingen_polyphonic);
return (polyphonic.is_valid() && polyphonic.get_bool());
}
@@ -106,7 +110,8 @@ void
ObjectModel::set_path(const Raul::Path& p)
{
_path = p;
- _meta.set_uri(ResourceImpl::meta_uri(_path));
+ _symbol = p.symbol();
+ _meta.set_uri(ResourceImpl::meta_uri(0));
signal_moved.emit();
}
@@ -114,7 +119,7 @@ ObjectModel::set_path(const Raul::Path& p)
void
ObjectModel::set_parent(SharedPtr<ObjectModel> p)
{
- assert(p);
+ assert(_path.is_child_of(p->path()));
_parent = p;
}
diff --git a/src/client/ObjectModel.hpp b/src/client/ObjectModel.hpp
index 7ce19e9c..2c1fd23e 100644
--- a/src/client/ObjectModel.hpp
+++ b/src/client/ObjectModel.hpp
@@ -61,9 +61,9 @@ public:
Resource& meta() { return _meta; }
const Resource& meta() const { return _meta; }
- const Raul::URI meta_uri() const { return _meta.uri(); }
- const Raul::Path path() const { return _path; }
- const Raul::Symbol symbol() const { return _path.name(); }
+ const Raul::URI& meta_uri() const { return _meta.uri(); }
+ const Raul::Path& path() const { return _path; }
+ const Raul::Symbol& symbol() const { return _symbol; }
SharedPtr<ObjectModel> parent() const { return _parent; }
bool polyphonic() const;
@@ -89,8 +89,12 @@ protected:
virtual void set(SharedPtr<ObjectModel> model);
ResourceImpl _meta;
- Raul::Path _path;
+
SharedPtr<ObjectModel> _parent;
+
+private:
+ Raul::Path _path;
+ Raul::Symbol _symbol;
};
diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp
index 376a6a68..7b29b3f6 100644
--- a/src/client/PatchModel.cpp
+++ b/src/client/PatchModel.cpp
@@ -17,6 +17,8 @@
#include <cassert>
#include "raul/log.hpp"
+#include "module/ingen_module.hpp"
+#include "shared/LV2URIMap.hpp"
#include "PatchModel.hpp"
#include "NodeModel.hpp"
#include "ConnectionModel.hpp"
@@ -49,7 +51,7 @@ PatchModel::add_child(SharedPtr<ObjectModel> c)
bool
PatchModel::remove_child(SharedPtr<ObjectModel> o)
{
- assert(o->path().is_child_of(_path));
+ assert(o->path().is_child_of(path()));
assert(o->parent().get() == this);
// Remove any connections which referred to this object,
@@ -163,7 +165,7 @@ PatchModel::remove_connection(const Path& src_port_path, const Path& dst_port_pa
bool
PatchModel::enabled() const
{
- const Raul::Atom& enabled = get_property("ingen:enabled");
+ const Raul::Atom& enabled = get_property(ingen_get_world()->uris->ingen_enabled);
return (enabled.is_valid() && enabled.get_bool());
}
@@ -171,7 +173,7 @@ PatchModel::enabled() const
Raul::Atom&
PatchModel::set_meta_property(const Raul::URI& key, const Atom& value)
{
- if (key.str() == "ingen:polyphony")
+ if (key == ingen_get_world()->uris->ingen_polyphony)
_poly = value.get_int32();
return NodeModel::set_meta_property(key, value);
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index c40bb7ef..d740a3c1 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -18,9 +18,11 @@
#include <sstream>
#include <ctype.h>
#include <boost/optional.hpp>
-#include "ingen-config.h"
#include "raul/Path.hpp"
#include "raul/Atom.hpp"
+#include "ingen-config.h"
+#include "module/ingen_module.hpp"
+#include "shared/LV2URIMap.hpp"
#include "PluginModel.hpp"
#include "PatchModel.hpp"
#include "PluginUI.hpp"
@@ -54,7 +56,7 @@ PluginModel::PluginModel(const URI& uri, const URI& type_uri, const Resource::Pr
slv2_value_free(plugin_uri);
#endif
if (_type == Internal)
- set_property("doap:name", Atom(uri.substr(uri.find_last_of("#") + 1).c_str()));
+ set_property("doap:name", Atom(uri.substr(uri.find_last_of('#') + 1).c_str()));
}
@@ -67,13 +69,13 @@ PluginModel::get_property(const URI& key) const
return val;
// No lv2:symbol from data or engine, invent one
- if (key.str() == "lv2:symbol") {
+ if (key == ingen_get_world()->uris->lv2_symbol) {
const URI& uri = this->uri();
- size_t last_slash = uri.find_last_of("/");
- size_t last_hash = uri.find_last_of("#");
+ size_t last_slash = uri.find_last_of('/');
+ size_t last_hash = uri.find_last_of('#');
string symbol;
if (last_slash == string::npos && last_hash == string::npos) {
- size_t last_colon = uri.find_last_of(":");
+ size_t last_colon = uri.find_last_of(':');
if (last_colon != string::npos)
symbol = uri.substr(last_colon + 1);
else
@@ -90,7 +92,7 @@ PluginModel::get_property(const URI& key) const
else
symbol = uri.str().substr(first_delim + 1, last_delim - first_delim - 1);
}
- set_property("lv2:symbol", Atom(Atom::STRING, symbol));
+ set_property("lv2:symbol", symbol);
return get_property(key);
}
@@ -107,7 +109,7 @@ PluginModel::get_property(const URI& key) const
ret = set_property(key, Atom(Atom::URI, slv2_value_as_uri(val)));
break;
} else if (slv2_value_is_string(val)) {
- ret = set_property(key, Atom(Atom::STRING, slv2_value_as_string(val)));
+ ret = set_property(key, slv2_value_as_string(val));
break;
} else if (slv2_value_is_float(val)) {
ret = set_property(key, Atom(slv2_value_as_float(val)));
@@ -163,10 +165,10 @@ string
PluginModel::human_name()
{
const Atom& name_atom = get_property("doap:name");
- if (name_atom.is_valid() && name_atom.type() == Atom::STRING)
+ if (name_atom.type() == Atom::STRING)
return name_atom.get_string();
else
- return default_node_symbol();
+ return default_node_symbol().c_str();
}
diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp
index 4c8016fd..0df3b060 100644
--- a/src/client/PluginUI.cpp
+++ b/src/client/PluginUI.cpp
@@ -55,8 +55,7 @@ lv2_ui_write(LV2UI_Controller controller,
SharedPtr<PortModel> port = ui->node()->ports()[port_index];
- SharedPtr<Shared::LV2URIMap> map = PtrCast<Shared::LV2URIMap>(
- ui->world()->lv2_features->feature(LV2_URI_MAP_URI));
+ SharedPtr<Shared::LV2URIMap> map = ui->world()->uris;
// float (special case, always 0)
if (format == 0) {
@@ -64,18 +63,18 @@ lv2_ui_write(LV2UI_Controller controller,
if (*(float*)buffer == port->value().get_float())
return; // do nothing (handle stupid plugin UIs that feed back)
- ui->world()->engine->set_property(port->path(), "ingen:value", Atom(*(float*)buffer));
+ ui->world()->engine->set_property(port->path(), map->ingen_value, Atom(*(float*)buffer));
- } else if (format == map->ui_format_events) {
+ } else if (format == map->ui_format_events.id) {
LV2_Event_Buffer* buf = (LV2_Event_Buffer*)buffer;
LV2_Event_Iterator iter;
uint8_t* data;
lv2_event_begin(&iter, buf);
while (lv2_event_is_valid(&iter)) {
LV2_Event* const ev = lv2_event_get(&iter, &data);
- if (ev->type == map->midi_event) {
+ if (ev->type == map->midi_event.id) {
// FIXME: bundle multiple events by writing an entire buffer here
- ui->world()->engine->set_property(port->path(), "ingen:value",
+ ui->world()->engine->set_property(port->path(), map->ingen_value,
Atom("lv2midi:MidiEvent", ev->size, data));
} else {
warn << "Unable to send event type " << ev->type <<
@@ -85,11 +84,11 @@ lv2_ui_write(LV2UI_Controller controller,
lv2_event_increment(&iter);
}
- } else if (format == map->object_transfer) {
+ } else if (format == map->object_transfer.id) {
LV2_Object* buf = (LV2_Object*)buffer;
Raul::Atom val;
Shared::LV2Object::to_atom(ui->world(), buf, val);
- ui->world()->engine->set_property(port->path(), "ingen:value", val);
+ ui->world()->engine->set_property(port->path(), map->ingen_value, val);
} else {
warn << "Unknown value format " << format
diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp
index 9d63c863..5eb578d7 100644
--- a/src/client/PortModel.cpp
+++ b/src/client/PortModel.cpp
@@ -15,12 +15,27 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "module/ingen_module.hpp"
+#include "module/World.hpp"
+#include "shared/LV2URIMap.hpp"
#include "PortModel.hpp"
#include "NodeModel.hpp"
namespace Ingen {
namespace Client {
+
+Raul::Atom&
+PortModel::set_property(const Raul::URI& uri,
+ const Raul::Atom& value)
+{
+ Raul::Atom& ret = ObjectModel::set_property(uri, value);
+ if (uri == ingen_get_world()->uris->ingen_value)
+ this->value(value);
+ return ret;
+}
+
+
bool
PortModel::has_hint(const std::string& qname) const
{
@@ -28,6 +43,7 @@ PortModel::has_hint(const std::string& qname) const
return (hint.is_valid() && hint.get_bool() > 0);
}
+
void
PortModel::set(SharedPtr<ObjectModel> model)
{
@@ -44,5 +60,6 @@ PortModel::set(SharedPtr<ObjectModel> model)
ObjectModel::set(model);
}
+
} // namespace Client
} // namespace Ingen
diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp
index 58f3262e..5a944532 100644
--- a/src/client/PortModel.hpp
+++ b/src/client/PortModel.hpp
@@ -26,9 +26,6 @@
#include "interface/Port.hpp"
#include "ObjectModel.hpp"
-#include <stdio.h>
-
-
namespace Raul { class Path; }
namespace Ingen {
@@ -57,15 +54,9 @@ public:
bool is_integer() const { return has_hint("lv2:integer"); }
bool is_toggle() const { return has_hint("lv2:toggled"); }
- inline bool operator==(const PortModel& pm) const { return (_path == pm._path); }
+ inline bool operator==(const PortModel& pm) const { return (path() == pm.path()); }
- Raul::Atom& set_property(const Raul::URI& uri,
- const Raul::Atom& value) {
- Raul::Atom& ret = ObjectModel::set_property(uri, value);
- if (uri.str() == "ingen:value")
- this->value(value);
- return ret;
- }
+ Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value);
inline void value(const Raul::Atom& val) {
if (val != _current_val) {
diff --git a/src/common/interface/GraphObject.hpp b/src/common/interface/GraphObject.hpp
index 68242a46..91058858 100644
--- a/src/common/interface/GraphObject.hpp
+++ b/src/common/interface/GraphObject.hpp
@@ -44,9 +44,9 @@ public:
virtual void set_path(const Raul::Path& path) = 0;
- virtual const Raul::Path path() const = 0;
- virtual const Raul::Symbol symbol() const = 0;
- virtual bool polyphonic() const = 0;
+ virtual const Raul::Path& path() const = 0;
+ virtual const Raul::Symbol& symbol() const = 0;
+ virtual bool polyphonic() const = 0;
virtual GraphObject* graph_parent() const = 0;
};
diff --git a/src/common/interface/Resource.hpp b/src/common/interface/Resource.hpp
index 4939d7b1..7a40f8bb 100644
--- a/src/common/interface/Resource.hpp
+++ b/src/common/interface/Resource.hpp
@@ -33,7 +33,7 @@ public:
virtual ~Resource() {}
typedef std::multimap<Raul::URI, Raul::Atom> Properties;
- virtual const Raul::URI uri() const = 0;
+ virtual const Raul::URI& uri() const = 0;
virtual const Properties& properties() const = 0;
virtual Properties& properties() = 0;
diff --git a/src/engine/BufferFactory.cpp b/src/engine/BufferFactory.cpp
index 87caa2af..39c644e2 100644
--- a/src/engine/BufferFactory.cpp
+++ b/src/engine/BufferFactory.cpp
@@ -88,15 +88,15 @@ BufferFactory::create(Shared::PortType type, size_t size)
if (size == 0)
size = sizeof(LV2_Object) + sizeof(float);
AudioBuffer* ret = new AudioBuffer(*this, type, size);
- ret->object()->type = _map->object_class_vector;
- ((LV2_Vector_Body*)ret->object()->body)->elem_type = _map->object_class_float32;
+ ret->object()->type = _map->object_class_vector.id;
+ ((LV2_Vector_Body*)ret->object()->body)->elem_type = _map->object_class_float32.id;
buffer = ret;
} else if (type.is_audio()) {
if (size == 0)
size = sizeof(LV2_Object) + sizeof(LV2_Vector_Body)
+ _engine.driver()->buffer_size() * sizeof(float);
AudioBuffer* ret = new AudioBuffer(*this, type, size);
- ret->object()->type = _map->object_class_float32;
+ ret->object()->type = _map->object_class_float32.id;
buffer = ret;
} else if (type.is_events()) {
if (size == 0)
diff --git a/src/engine/ControlBindings.cpp b/src/engine/ControlBindings.cpp
index 2874fa05..43e30338 100644
--- a/src/engine/ControlBindings.cpp
+++ b/src/engine/ControlBindings.cpp
@@ -107,7 +107,7 @@ ControlBindings::process(ProcessContext& context, EventBuffer* buffer)
if (_learn_port) {
buffer->rewind();
while (buffer->get_event(&frames, &subframes, &type, &size, &buf)) {
- if (type == _map->midi_event && (buf[0] & 0xF0) == MIDI_CMD_CONTROL) {
+ if (type == _map->midi_event.id && (buf[0] & 0xF0) == MIDI_CMD_CONTROL) {
const int8_t controller = static_cast<const int8_t>(buf[1]);
bind(context, controller);
break;
@@ -119,7 +119,7 @@ ControlBindings::process(ProcessContext& context, EventBuffer* buffer)
if (!bindings->empty()) {
buffer->rewind();
while (buffer->get_event(&frames, &subframes, &type, &size, &buf)) {
- if (type == _map->midi_event && (buf[0] & 0xF0) == MIDI_CMD_CONTROL) {
+ if (type == _map->midi_event.id && (buf[0] & 0xF0) == MIDI_CMD_CONTROL) {
const int8_t controller = static_cast<const int8_t>(buf[1]);
const int8_t value = static_cast<const int8_t>(buf[2]);
Bindings::const_iterator i = bindings->find(controller);
diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp
index 437389d3..26febf3b 100644
--- a/src/engine/Engine.cpp
+++ b/src/engine/Engine.cpp
@@ -65,10 +65,8 @@ Engine::Engine(Ingen::Shared::World* world)
, _broadcaster(new ClientBroadcaster())
, _node_factory(new NodeFactory(world))
, _message_context(new MessageContext(*this))
- , _buffer_factory(new BufferFactory(*this, PtrCast<LV2URIMap>(
- world->lv2_features->feature(LV2_URI_MAP_URI))))
- , _control_bindings(new ControlBindings(*this, PtrCast<LV2URIMap>(
- world->lv2_features->feature(LV2_URI_MAP_URI))))
+ , _buffer_factory(new BufferFactory(*this, world->uris))
+ , _control_bindings(new ControlBindings(*this, world->uris))
, _quit_flag(false)
, _activated(false)
{
@@ -165,14 +163,16 @@ Engine::activate()
for (EventSources::iterator i = _event_sources.begin(); i != _event_sources.end(); ++i)
(*i)->activate_source();
+ const LV2URIMap& uris = *world()->uris;
+
// Create root patch
PatchImpl* root_patch = _driver->root_patch();
if (!root_patch) {
- root_patch = new PatchImpl(*this, "", 1, NULL,
+ root_patch = new PatchImpl(*this, "root", 1, NULL,
_driver->sample_rate(), _driver->buffer_size(), 1);
- root_patch->meta().set_property("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Patch"));
- root_patch->meta().set_property("ingen:polyphony", Raul::Atom(int32_t(1)));
- root_patch->set_property("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Node"));
+ root_patch->meta().set_property(uris.rdf_type, Raul::Atom(Raul::Atom::URI, "ingen:Patch"));
+ root_patch->meta().set_property(uris.ingen_polyphony, Raul::Atom(int32_t(1)));
+ root_patch->set_property(uris.rdf_type, Raul::Atom(Raul::Atom::URI, "ingen:Node"));
root_patch->activate();
_world->store->add(root_patch);
root_patch->compiled_patch(root_patch->compile());
@@ -180,7 +180,7 @@ Engine::activate()
// Add control port
Shared::Resource::Properties properties;
- properties.insert(make_pair("lv2:name", "Control"));
+ properties.insert(make_pair(uris.lv2_name, "Control"));
Events::CreatePort* ev = new Events::CreatePort(*this, SharedPtr<Responder>(), 0,
"/ingen_control", "lv2ev:EventPort", false, NULL, properties);
ev->pre_process();
diff --git a/src/engine/GraphObjectImpl.cpp b/src/engine/GraphObjectImpl.cpp
index 50b0e58b..60aefa85 100644
--- a/src/engine/GraphObjectImpl.cpp
+++ b/src/engine/GraphObjectImpl.cpp
@@ -28,15 +28,14 @@ namespace Ingen {
using namespace Shared;
-GraphObjectImpl::GraphObjectImpl(GraphObjectImpl* parent, const std::string& name, bool polyphonic)
- : ResourceImpl((parent ? parent->path().base() : Raul::Path::root_uri) + name)
+GraphObjectImpl::GraphObjectImpl(GraphObjectImpl* parent, const Symbol& symbol, bool polyphonic)
+ : ResourceImpl(parent ? parent->path().child(symbol) : Raul::Path::root.child(symbol))
, _parent(parent)
- , _name(name)
+ , _path(parent ? parent->path().child(symbol) : "/")
+ , _symbol(symbol)
, _meta(ResourceImpl::meta_uri(uri()))
, _polyphonic(polyphonic)
{
- assert(parent == NULL || _name.length() > 0);
- assert(_name.find("/") == std::string::npos);
}
diff --git a/src/engine/GraphObjectImpl.hpp b/src/engine/GraphObjectImpl.hpp
index b9e13219..82ff7f53 100644
--- a/src/engine/GraphObjectImpl.hpp
+++ b/src/engine/GraphObjectImpl.hpp
@@ -51,9 +51,9 @@ class GraphObjectImpl : virtual public Ingen::Shared::GraphObject
public:
virtual ~GraphObjectImpl() {}
- const Raul::URI meta_uri() const { return _meta.uri(); }
- const Raul::URI uri() const { return path(); }
- const Raul::Symbol symbol() const { return _name; }
+ const Raul::URI& meta_uri() const { return _meta.uri(); }
+ const Raul::URI& uri() const { return _path; }
+ const Raul::Symbol& symbol() const { return _symbol; }
bool polyphonic() const { return _polyphonic; }
virtual bool set_polyphonic(Raul::Maid& maid, bool p) { _polyphonic = p; return true; }
@@ -67,9 +67,8 @@ public:
/** Rename */
virtual void set_path(const Raul::Path& new_path) {
- assert(new_path.parent() == path().parent());
- _name = new_path.name();
- assert(_name.find("/") == std::string::npos);
+ _path = new_path;
+ _symbol = new_path.symbol();
}
const Raul::Atom& get_property(const Raul::URI& key) const;
@@ -80,22 +79,16 @@ public:
virtual PatchImpl* parent_patch() const;
/** Raul::Path is dynamically generated from parent to ease renaming */
- const Raul::Path path() const {
- if (!_parent)
- return Raul::Path(std::string("/").append(_name));
- else if (_parent->path().is_root())
- return Raul::Path(std::string("/").append(_name));
- else
- return Raul::Path(_parent->path().child(_name));
- }
+ const Raul::Path& path() const { return _path; }
SharedPtr<GraphObject> find_child(const std::string& name) const;
protected:
- GraphObjectImpl(GraphObjectImpl* parent, const std::string& name, bool polyphonic=false);
+ GraphObjectImpl(GraphObjectImpl* parent, const Raul::Symbol& symbol, bool polyphonic=false);
GraphObjectImpl* _parent;
- std::string _name;
+ Raul::Path _path;
+ Raul::Symbol _symbol;
ResourceImpl _meta;
bool _polyphonic;
};
diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp
index a621132a..025243eb 100644
--- a/src/engine/HTTPEngineReceiver.cpp
+++ b/src/engine/HTTPEngineReceiver.cpp
@@ -117,7 +117,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const
// Special GET paths
if (msg->method == SOUP_METHOD_GET) {
- if (path == Path::root_uri || path == "") {
+ if (path == Path::root.str() || path == "") {
const string r = string("@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n")
.append("\n<> rdfs:seeAlso <plugins> ;")
.append("\n rdfs:seeAlso <stream> ;")
diff --git a/src/engine/InternalPlugin.cpp b/src/engine/InternalPlugin.cpp
index 0c848feb..946ed956 100644
--- a/src/engine/InternalPlugin.cpp
+++ b/src/engine/InternalPlugin.cpp
@@ -16,12 +16,14 @@
*/
#include <cassert>
-#include "InternalPlugin.hpp"
+#include "module/ingen_module.hpp"
+#include "shared/LV2URIMap.hpp"
#include "internals/Note.hpp"
#include "internals/Trigger.hpp"
#include "internals/Controller.hpp"
-#include "Engine.hpp"
#include "Driver.hpp"
+#include "Engine.hpp"
+#include "InternalPlugin.hpp"
using namespace std;
using namespace Raul;
@@ -34,7 +36,8 @@ InternalPlugin::InternalPlugin(const std::string& uri, const std::string& symbol
: PluginImpl(Plugin::Internal, uri)
, _symbol(symbol)
{
- set_property("rdf:type", Atom(Atom::URI, "ingen:Internal"));
+ const LV2URIMap& uris = *ingen_get_world()->uris.get();
+ set_property(uris.rdf_type, uris.ingen_Internal);
}
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp
index 1cd7d3ee..24291fa9 100644
--- a/src/engine/JackDriver.cpp
+++ b/src/engine/JackDriver.cpp
@@ -194,9 +194,8 @@ JackDriver::JackDriver(Engine& engine)
, _process_context(engine)
, _root_patch(NULL)
{
- SharedPtr<Shared::LV2URIMap> map = PtrCast<Shared::LV2URIMap>(
- _engine.world()->lv2_features->feature(LV2_URI_MAP_URI));
- _midi_event_type = map->uri_to_id(NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent");
+ _midi_event_type = _engine.world()->uris->uri_to_id(
+ NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent");
}
diff --git a/src/engine/LADSPAPlugin.cpp b/src/engine/LADSPAPlugin.cpp
index 1f316849..e1fdff40 100644
--- a/src/engine/LADSPAPlugin.cpp
+++ b/src/engine/LADSPAPlugin.cpp
@@ -18,6 +18,8 @@
#include <cassert>
#include <ladspa.h>
#include <raul/Symbol.hpp>
+#include "module/ingen_module.hpp"
+#include "shared/LV2URIMap.hpp"
#include "LADSPAPlugin.hpp"
#include "LADSPANode.hpp"
#include "Engine.hpp"
@@ -38,18 +40,19 @@ LADSPAPlugin::LADSPAPlugin(
: PluginImpl(Plugin::LADSPA, uri, library_path)
, _id(id)
, _label(label)
- , _name(Raul::Atom::STRING, name)
+ , _name(name)
{
- set_property("rdf:type", Atom(Atom::URI, "ingen:LADSPAPlugin"));
- set_property("lv2:symbol", Atom(Atom::STRING, Symbol::symbolify(label)));
- set_property("doap:name", Atom(Atom::STRING, name));
+ const LV2URIMap& uris = *ingen_get_world()->uris;
+ set_property(uris.rdf_type, uris.ingen_LADSPAPlugin);
+ set_property(uris.lv2_symbol, Symbol::symbolify(label));
+ set_property(uris.doap_name, name);
}
const Raul::Atom&
LADSPAPlugin::get_property(const Raul::URI& uri) const
{
- if (uri.str() == "doap:name")
+ if (uri == ingen_get_world()->uris->doap_name)
return _name;
else
return ResourceImpl::get_property(uri);
diff --git a/src/engine/LV2Plugin.cpp b/src/engine/LV2Plugin.cpp
index eafa3be2..5a0502d4 100644
--- a/src/engine/LV2Plugin.cpp
+++ b/src/engine/LV2Plugin.cpp
@@ -18,6 +18,8 @@
#include <cassert>
#include <glibmm.h>
#include "redlandmm/World.hpp"
+#include "module/ingen_module.hpp"
+#include "shared/LV2URIMap.hpp"
#include "LV2Plugin.hpp"
#include "LV2Node.hpp"
#include "NodeImpl.hpp"
@@ -35,9 +37,11 @@ LV2Plugin::LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri)
, _slv2_plugin(NULL)
, _lv2_info(lv2_info)
{
- set_property("rdf:type", Atom(Atom::URI, "lv2:Plugin"));
+ const LV2URIMap& uris = *ingen_get_world()->uris.get();
+ set_property(uris.rdf_type, uris.lv2_Plugin);
}
+
const string
LV2Plugin::symbol() const
{
diff --git a/src/engine/NodeBase.cpp b/src/engine/NodeBase.cpp
index 0a30b33a..5874c93f 100644
--- a/src/engine/NodeBase.cpp
+++ b/src/engine/NodeBase.cpp
@@ -33,8 +33,8 @@ using namespace std;
namespace Ingen {
-NodeBase::NodeBase(PluginImpl* plugin, const string& name, bool polyphonic, PatchImpl* parent, SampleRate srate, size_t buffer_size)
- : NodeImpl(parent, name, polyphonic)
+NodeBase::NodeBase(PluginImpl* plugin, const Raul::Symbol& symbol, bool polyphonic, PatchImpl* parent, SampleRate srate, size_t buffer_size)
+ : NodeImpl(parent, symbol, polyphonic)
, _plugin(plugin)
, _polyphony((polyphonic && parent) ? parent->internal_polyphony() : 1)
, _srate(srate)
diff --git a/src/engine/NodeBase.hpp b/src/engine/NodeBase.hpp
index a85d51b5..950a79a3 100644
--- a/src/engine/NodeBase.hpp
+++ b/src/engine/NodeBase.hpp
@@ -48,12 +48,12 @@ namespace Shared { class ClientInterface; }
class NodeBase : public NodeImpl
{
public:
- NodeBase(PluginImpl* plugin,
- const std::string& name,
- bool poly,
- PatchImpl* parent,
- SampleRate rate,
- size_t buffer_size);
+ NodeBase(PluginImpl* plugin,
+ const Raul::Symbol& symbol,
+ bool poly,
+ PatchImpl* parent,
+ SampleRate rate,
+ size_t buffer_size);
virtual ~NodeBase();
diff --git a/src/engine/NodeImpl.hpp b/src/engine/NodeImpl.hpp
index 01901df9..d6923ff3 100644
--- a/src/engine/NodeImpl.hpp
+++ b/src/engine/NodeImpl.hpp
@@ -53,8 +53,8 @@ class ProcessContext;
class NodeImpl : public GraphObjectImpl, virtual public Ingen::Shared::Node
{
public:
- NodeImpl(GraphObjectImpl* parent, const std::string& name, bool poly)
- : GraphObjectImpl(parent, name, poly)
+ NodeImpl(GraphObjectImpl* parent, const Raul::Symbol& symbol, bool poly)
+ : GraphObjectImpl(parent, symbol, poly)
{}
/** Activate this Node.
diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp
index 198296ec..f4cd6664 100644
--- a/src/engine/ObjectSender.cpp
+++ b/src/engine/ObjectSender.cpp
@@ -17,6 +17,8 @@
#include "ObjectSender.hpp"
#include "interface/ClientInterface.hpp"
+#include "module/ingen_module.hpp"
+#include "shared/LV2URIMap.hpp"
#include "EngineStore.hpp"
#include "PatchImpl.hpp"
#include "NodeImpl.hpp"
@@ -135,16 +137,18 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port, bool bund
if (graph_parent)
client->put(port->meta_uri(), port->meta().properties());
+ const Shared::LV2URIMap& map = *ingen_get_world()->uris.get();
+
client->put(port->path(), port->properties());
if (graph_parent && graph_parent->internal_polyphony() > 1)
- client->set_property(port->meta_uri(), "ingen:polyphonic", bool(port->polyphonic()));
+ client->set_property(port->meta_uri(), map.ingen_polyphonic, bool(port->polyphonic()));
// Send control value
if (port->type() == PortType::CONTROL) {
//const Sample& value = PtrCast<const AudioBuffer>(port->buffer(0))->value_at(0);
const Sample& value = ((const AudioBuffer*)port->buffer(0).get())->value_at(0);
- client->set_property(port->path(), "ingen:value", value);
+ client->set_property(port->path(), map.ingen_value, value);
}
if (bundle)
diff --git a/src/engine/ObjectSender.hpp b/src/engine/ObjectSender.hpp
index 54b3bbbb..4e61d01a 100644
--- a/src/engine/ObjectSender.hpp
+++ b/src/engine/ObjectSender.hpp
@@ -18,8 +18,6 @@
#ifndef INGEN_ENGINE_OBJECTSENDER_HPP
#define INGEN_ENGINE_OBJECTSENDER_HPP
-#include <list>
-
namespace Ingen {
namespace Shared { class ClientInterface; }
diff --git a/src/engine/PatchImpl.cpp b/src/engine/PatchImpl.cpp
index 771c9d6d..a0172679 100644
--- a/src/engine/PatchImpl.cpp
+++ b/src/engine/PatchImpl.cpp
@@ -37,9 +37,9 @@ namespace Ingen {
using namespace Shared;
-PatchImpl::PatchImpl(Engine& engine, const string& path, uint32_t poly, PatchImpl* parent, SampleRate srate, size_t buffer_size, uint32_t internal_poly)
+PatchImpl::PatchImpl(Engine& engine, const Raul::Symbol& symbol, uint32_t poly, PatchImpl* parent, SampleRate srate, size_t buffer_size, uint32_t internal_poly)
: NodeBase(new PatchPlugin("http://example.org/FIXME", "patch", "Ingen Patch"),
- path, poly, parent, srate, buffer_size)
+ symbol, poly, parent, srate, buffer_size)
, _engine(engine)
, _internal_poly(internal_poly)
, _compiled_patch(NULL)
@@ -281,7 +281,7 @@ PatchImpl::add_node(List<NodeImpl*>::Node* ln)
* Preprocessing thread only.
*/
PatchImpl::Nodes::Node*
-PatchImpl::remove_node(const string& symbol)
+PatchImpl::remove_node(const Raul::Symbol& symbol)
{
ThreadManager::assert_thread(THREAD_PRE_PROCESS);
for (List<NodeImpl*>::iterator i = _nodes.begin(); i != _nodes.end(); ++i)
diff --git a/src/engine/PatchImpl.hpp b/src/engine/PatchImpl.hpp
index e86cb1bc..54839e92 100644
--- a/src/engine/PatchImpl.hpp
+++ b/src/engine/PatchImpl.hpp
@@ -48,13 +48,13 @@ class ProcessContext;
class PatchImpl : public NodeBase, public Ingen::Shared::Patch
{
public:
- PatchImpl(Engine& engine,
- const std::string& name,
- uint32_t poly,
- PatchImpl* parent,
- SampleRate srate,
- size_t buffer_size,
- uint32_t local_poly);
+ PatchImpl(Engine& engine,
+ const Raul::Symbol& symbol,
+ uint32_t poly,
+ PatchImpl* parent,
+ SampleRate srate,
+ size_t buffer_size,
+ uint32_t local_poly);
virtual ~PatchImpl();
@@ -86,7 +86,7 @@ public:
typedef Raul::List<NodeImpl*> Nodes;
void add_node(Nodes::Node* tn);
- Nodes::Node* remove_node(const std::string& name);
+ Nodes::Node* remove_node(const Raul::Symbol& symbol);
Nodes& nodes() { return _nodes; }
Connections& connections() { return _connections; }
diff --git a/src/engine/PortImpl.cpp b/src/engine/PortImpl.cpp
index 62206710..e2c25dc7 100644
--- a/src/engine/PortImpl.cpp
+++ b/src/engine/PortImpl.cpp
@@ -17,6 +17,8 @@
#include "raul/Array.hpp"
#include "raul/Maid.hpp"
+#include "module/ingen_module.hpp"
+#include "shared/LV2URIMap.hpp"
#include "contexts.lv2/contexts.h"
#include "interface/PortType.hpp"
#include "events/SendPortValue.hpp"
@@ -75,7 +77,8 @@ PortImpl::PortImpl(BufferFactory& bufs,
else
_polyphonic = true;
- add_property("rdf:type", Atom(Atom::URI, type.uri()));
+ add_property("rdf:type", Atom(Atom::URI, type.uri()));
+ set_property("lv2:index", Atom((int32_t)index));
set_context(_context);
if (type == PortType::EVENTS)
@@ -197,23 +200,23 @@ PortImpl::broadcast_value(Context& context, bool force)
if (val.type() == Atom::FLOAT && (force || val != _last_broadcasted_value)) {
_last_broadcasted_value = val;
- const Events::SendPortValue ev(context.engine(), context.start(), this, false, 0, val);
+ const Events::SendPortValue ev(context.engine(), context.start(), this, true, 0, val);
context.event_sink().write(sizeof(ev), &ev);
}
-
}
void
PortImpl::set_context(Context::ID c)
{
+ const LV2URIMap& uris = *ingen_get_world()->uris.get();
_context = c;
switch (c) {
case Context::AUDIO:
- set_property("ctx:context", Atom(Atom::URI, "ctx:AudioContext"));
+ set_property(uris.ctx_context, uris.ctx_AudioContext);
break;
case Context::MESSAGE:
- set_property("ctx:context", Atom(Atom::URI, "ctx:MessageContext"));
+ set_property(uris.ctx_context, uris.ctx_MessageContext);
break;
}
}
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;
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index 0de1a7ea..78839772 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -113,7 +113,8 @@ public:
static void init(Ingen::Shared::World* world);
static void run();
- Ingen::Shared::World* world() { return _world; }
+ inline Ingen::Shared::World* world() { return _world; }
+ inline Ingen::Shared::LV2URIMap& uris() { return *_world->uris; }
protected:
diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp
index 492a634b..c66d98a2 100644
--- a/src/gui/BreadCrumbs.hpp
+++ b/src/gui/BreadCrumbs.hpp
@@ -80,7 +80,7 @@ private:
void set_path(const Raul::Path& path) {
remove();
- const std::string text = (path.is_root()) ? "/" : path.name().c_str();
+ const char* text = (path.is_root()) ? "/" : path.symbol();
Gtk::Label* lab = manage(new Gtk::Label(text));
lab->set_padding(0, 0);
lab->show();
diff --git a/src/gui/ControlPanel.cpp b/src/gui/ControlPanel.cpp
index e393b7ca..bcbc0824 100644
--- a/src/gui/ControlPanel.cpp
+++ b/src/gui/ControlPanel.cpp
@@ -16,6 +16,7 @@
*/
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "client/PortModel.hpp"
#include "client/PluginModel.hpp"
@@ -185,7 +186,9 @@ ControlPanel::value_changed_atom(SharedPtr<PortModel> port, const Raul::Atom& va
{
if (_callback_enabled) {
if (_all_voices_radio->get_active()) {
- App::instance().engine()->set_property(port->path(), "ingen:value", val);
+ App::instance().engine()->set_property(port->path(),
+ App::instance().uris().ingen_value,
+ val);
port->value(val);
} else {
int voice = _voice_spinbutton->get_value_as_int();
@@ -213,7 +216,7 @@ ControlPanel::specific_voice_selected()
void
ControlPanel::parent_property_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
- if (predicate.str() == "ingen:polyphony" && value.type() == Atom::INT)
+ if (predicate == App::instance().uris().ingen_polyphony && value.type() == Atom::INT)
_voice_spinbutton->set_range(0, value.get_int32() - 1);
}
@@ -221,7 +224,7 @@ ControlPanel::parent_property_changed(const Raul::URI& predicate, const Raul::At
void
ControlPanel::variable_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
- if (predicate.str() == "ingen:polyphonic" && value.type() == Atom::BOOL) {
+ if (predicate == App::instance().uris().ingen_polyphony && value.type() == Atom::BOOL) {
if (value.get_bool())
_voice_control_box->show();
else
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp
index 8564fbed..d5ebc11f 100644
--- a/src/gui/Controls.cpp
+++ b/src/gui/Controls.cpp
@@ -19,6 +19,7 @@
#include <algorithm>
#include "raul/log.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PluginModel.hpp"
#include "client/NodeModel.hpp"
#include "client/PortModel.hpp"
@@ -136,7 +137,7 @@ SliderControl::init(ControlPanel* panel, SharedPtr<PortModel> pm)
assert(_name_label);
assert(_slider);
- set_name(pm->path().name());
+ set_name(pm->path().symbol());
_slider->set_draw_value(false);
@@ -221,9 +222,10 @@ SliderControl::port_property_change(const URI& key, const Atom& value)
{
_enable_signal = false;
- if (key.str() == "lv2:minimum" && value.type() == Atom::FLOAT)
+ const Shared::LV2URIMap& uris = App::instance().uris();
+ if (key == uris.lv2_minimum && value.type() == Atom::FLOAT)
set_range(value.get_float(), _slider->get_adjustment()->get_upper());
- else if (key.str() == "lv2:maximum" && value.type() == Atom::FLOAT)
+ else if (key == uris.lv2_maximum && value.type() == Atom::FLOAT)
set_range(_slider->get_adjustment()->get_lower(), value.get_float());
_enable_signal = true;
@@ -318,7 +320,7 @@ ToggleControl::init(ControlPanel* panel, SharedPtr<PortModel> pm)
assert(_name_label);
assert(_checkbutton);
- set_name(pm->path().name());
+ set_name(pm->path().symbol());
_checkbutton->signal_toggled().connect(sigc::mem_fun(*this, &ToggleControl::toggled));
set_value(pm->value());
@@ -383,7 +385,7 @@ StringControl::init(ControlPanel* panel, SharedPtr<PortModel> pm)
assert(_name_label);
assert(_entry);
- set_name(pm->path().name());
+ set_name(pm->path().symbol());
_entry->signal_activate().connect(sigc::mem_fun(*this, &StringControl::activated));
set_value(pm->value());
diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp
index cb3aaf06..db65968b 100644
--- a/src/gui/LoadPatchWindow.cpp
+++ b/src/gui/LoadPatchWindow.cpp
@@ -18,12 +18,13 @@
#include <sys/types.h>
#include <dirent.h>
#include <boost/optional/optional.hpp>
-#include "LoadPatchWindow.hpp"
#include "interface/EngineInterface.hpp"
-#include "client/PatchModel.hpp"
+#include "shared/LV2URIMap.hpp"
#include "shared/runtime_paths.hpp"
+#include "client/PatchModel.hpp"
#include "App.hpp"
#include "Configuration.hpp"
+#include "LoadPatchWindow.hpp"
#include "ThreadedLoader.hpp"
using namespace Ingen::Serialisation;
@@ -136,7 +137,9 @@ LoadPatchWindow::ok_clicked()
optional<Symbol> symbol;
if (_poly_from_user_radio->get_active())
- _initial_data.insert(make_pair("ingen:polyphony", _poly_spinbutton->get_value_as_int()));
+ _initial_data.insert(make_pair(
+ App::instance().uris().ingen_polyphony,
+ _poly_spinbutton->get_value_as_int()));
if (!_patch->path().is_root()) {
parent = _patch->path().parent();
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index a72277b3..e6cc1b4e 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -19,6 +19,7 @@
#include <algorithm>
#include <ctype.h>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/ClientStore.hpp"
#include "App.hpp"
@@ -324,6 +325,7 @@ LoadPluginWindow::generate_module_name(SharedPtr<PluginModel> plugin, int offset
void
LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
{
+ const LV2URIMap& uris = App::instance().uris();
Gtk::TreeModel::Row row = *iter;
SharedPtr<PluginModel> plugin = row.get_value(_plugins_columns._col_plugin);
bool polyphonic = _polyphonic_checkbutton->get_active();
@@ -341,18 +343,18 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
} else {
Path path = _patch->path().base() + Path::nameify(name);
Resource::Properties props = _initial_data;
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Node")));
- props.insert(make_pair("rdf:instanceOf", Atom(Atom::URI, plugin->uri().str())));
- props.insert(make_pair("ingen:polyphonic", polyphonic));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
+ props.insert(make_pair(uris.rdf_instanceOf, plugin->uri()));
+ props.insert(make_pair(uris.ingen_polyphonic, polyphonic));
App::instance().engine()->put(path, props);
if (_selection->get_selected_rows().size() == 1)
_node_name_entry->set_text(generate_module_name(plugin, _plugin_name_offset + 1));
// Cascade next node
- Atom& x = _initial_data.find("ingenui:canvas-x")->second;
+ Atom& x = _initial_data.find(uris.ingenui_canvas_x)->second;
x = Atom(x.get_float() + 20.0f);
- Atom& y = _initial_data.find("ingenui:canvas-y")->second;
+ Atom& y = _initial_data.find(uris.ingenui_canvas_y)->second;
y = Atom(y.get_float() + 20.0f);
}
}
@@ -445,7 +447,8 @@ LoadPluginWindow::plugin_property_changed(const URI& plugin,
const URI& predicate,
const Atom& value)
{
- if (predicate.str() == "doap:name") {
+ const LV2URIMap& uris = App::instance().uris();
+ if (predicate == uris.doap_name) {
Rows::const_iterator i = _rows.find(plugin);
if (i != _rows.end() && value.type() == Atom::STRING)
(*i->second)[_plugins_columns._col_name] = value.get_string();
diff --git a/src/gui/LoadSubpatchWindow.cpp b/src/gui/LoadSubpatchWindow.cpp
index ef56a945..d299e327 100644
--- a/src/gui/LoadSubpatchWindow.cpp
+++ b/src/gui/LoadSubpatchWindow.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <boost/optional.hpp>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "client/PatchModel.hpp"
#include "shared/runtime_paths.hpp"
@@ -158,18 +159,20 @@ LoadSubpatchWindow::ok_clicked()
symbol = Symbol::symbolify(name_str);
}
+ const LV2URIMap& uris = App::instance().uris();
+
if (_poly_from_user_radio->get_active()) {
- _initial_data.insert(make_pair("ingen:polyphony", (int)_poly_spinbutton->get_value_as_int()));
+ _initial_data.insert(make_pair(uris.ingen_polyphony, (int)_poly_spinbutton->get_value_as_int()));
} else if (_poly_from_parent_radio->get_active()) {
- _initial_data.insert(make_pair("ingen:polyphony", (int)_patch->poly()));
+ _initial_data.insert(make_pair(uris.ingen_polyphony, (int)_patch->poly()));
}
- std::list<Glib::ustring> uris = get_uris();
- for (std::list<Glib::ustring>::iterator i = uris.begin(); i != uris.end(); ++i) {
+ std::list<Glib::ustring> uri_list = get_uris();
+ for (std::list<Glib::ustring>::iterator i = uri_list.begin(); i != uri_list.end(); ++i) {
// Cascade
- Atom& x = _initial_data.find("ingenui:canvas-x")->second;
+ Atom& x = _initial_data.find(uris.ingenui_canvas_x)->second;
x = Atom(x.get_float() + 20.0f);
- Atom& y = _initial_data.find("ingenui:canvas-y")->second;
+ Atom& y = _initial_data.find(uris.ingenui_canvas_y)->second;
y = Atom(y.get_float() + 20.0f);
App::instance().loader()->load_patch(false, *i, Path("/"),
diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp
index 960eeacb..5a933b31 100644
--- a/src/gui/NewSubpatchWindow.cpp
+++ b/src/gui/NewSubpatchWindow.cpp
@@ -17,6 +17,7 @@
#include "App.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/ClientStore.hpp"
#include "NewSubpatchWindow.hpp"
@@ -91,17 +92,18 @@ NewSubpatchWindow::name_changed()
void
NewSubpatchWindow::ok_clicked()
{
+ App& app = App::instance();
const Path path = _patch->path().base() + Path::nameify(_name_entry->get_text());
const uint32_t poly = _poly_spinbutton->get_value_as_int();
Resource::Properties props;
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Patch")));
- props.insert(make_pair("ingen:polyphony", Atom(int32_t(poly))));
- App::instance().engine()->put(ResourceImpl::meta_uri(path), props);
+ props.insert(make_pair(app.uris().rdf_type, app.uris().ingen_Patch));
+ props.insert(make_pair(app.uris().ingen_polyphony, Atom(int32_t(poly))));
+ app.engine()->put(ResourceImpl::meta_uri(path), props);
props = _initial_data;
- props.insert(make_pair("ingen:enabled", bool(true)));
- App::instance().engine()->put(path, props);
+ props.insert(make_pair(app.uris().ingen_enabled, bool(true)));
+ app.engine()->put(path, props);
hide();
}
diff --git a/src/gui/NodeControlWindow.cpp b/src/gui/NodeControlWindow.cpp
index 07066d7d..4fce6636 100644
--- a/src/gui/NodeControlWindow.cpp
+++ b/src/gui/NodeControlWindow.cpp
@@ -17,6 +17,7 @@
#include <cmath>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "App.hpp"
#include "NodeControlWindow.hpp"
@@ -111,7 +112,8 @@ NodeControlWindow::on_show()
for (NodeModel::Ports::const_iterator i = _node->ports().begin();
i != _node->ports().end(); ++i)
if ((*i)->type().is_control() && (*i)->is_input())
- App::instance().engine()->request_property((*i)->path(), "ingen:value");
+ App::instance().engine()->request_property((*i)->path(),
+ App::instance().uris().ingen_value);
if (_position_stored)
move(_x, _y);
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index c801d3e7..ae735ad6 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -17,6 +17,7 @@
#include <gtkmm.h>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "client/PluginModel.hpp"
#include "App.hpp"
@@ -145,7 +146,8 @@ NodeMenu::on_menu_randomize()
float min = 0.0f, max = 1.0f;
nm->port_value_range(*i, min, max);
const float val = ((rand() / (float)RAND_MAX) * (max - min) + min);
- App::instance().engine()->set_property((*i)->path(), "ingen:value", val);
+ App::instance().engine()->set_property((*i)->path(),
+ App::instance().uris().ingen_value, val);
}
}
@@ -178,7 +180,7 @@ NodeMenu::on_preset_activated(const std::string uri)
SLV2Value val = slv2_results_get_binding_value(values, 1);
App::instance().engine()->set_property(
node->path().base() + slv2_value_as_string(sym),
- "ingen:value",
+ App::instance().uris().ingen_value,
slv2_value_as_float(val));
}
App::instance().engine()->bundle_end();
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index d9680237..277a65ad 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -20,6 +20,7 @@
#include "raul/log.hpp"
#include "raul/Atom.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/NodeModel.hpp"
#include "client/PluginModel.hpp"
@@ -45,7 +46,7 @@ namespace GUI {
NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> node)
- : FlowCanvas::Module(canvas, node->path().name(), 0, 0, true, canvas->show_port_names())
+ : FlowCanvas::Module(canvas, node->path().symbol(), 0, 0, true, canvas->show_port_names())
, _node(node)
, _gui_widget(NULL)
, _gui_window(NULL)
@@ -128,17 +129,17 @@ NodeModule::show_human_names(bool b)
}
if (!b)
- set_name(node()->symbol());
+ set_name(node()->symbol().c_str());
uint32_t index = 0;
for (PortVector::const_iterator i = ports().begin(); i != ports().end(); ++i) {
- string name = node()->port(index)->symbol();
+ Glib::ustring label(node()->port(index)->symbol().c_str());
if (b) {
- string hn = ((PluginModel*)node()->plugin())->port_human_name(index);
+ Glib::ustring hn = ((PluginModel*)node()->plugin())->port_human_name(index);
if (hn != "")
- name = hn;
+ label = hn;
}
- (*i)->set_name(name);
+ (*i)->set_name(label);
++index;
}
@@ -243,28 +244,21 @@ NodeModule::embed_gui(bool embed)
void
NodeModule::rename()
{
- set_name(_node->path().name());
- resize();
+ if (App::instance().configuration()->name_style() == Configuration::PATH) {
+ set_name(_node->path().symbol());
+ resize();
+ }
}
void
NodeModule::add_port(SharedPtr<PortModel> port, bool resize_to_fit)
{
- uint32_t index = _ports.size(); // FIXME: kludge, engine needs to tell us this
-
- string name = port->path().name();
- if (App::instance().configuration()->name_style() == Configuration::HUMAN && node()->plugin()) {
- string hn = ((PluginModel*)node()->plugin())->port_human_name(index);
- if (hn != "")
- name = hn;
- }
-
- Module::add_port(boost::shared_ptr<Port>(
- new Port(PtrCast<NodeModule>(shared_from_this()), port, name)));
+ Module::add_port(Port::create(PtrCast<NodeModule>(shared_from_this()), port,
+ App::instance().configuration()->name_style() == Configuration::HUMAN));
port->signal_value_changed.connect(sigc::bind<0>(
- sigc::mem_fun(this, &NodeModule::value_changed), index));
+ sigc::mem_fun(this, &NodeModule::value_changed), port->index()));
if (resize_to_fit)
resize();
@@ -379,14 +373,16 @@ NodeModule::store_location()
const float x = static_cast<float>(property_x());
const float y = static_cast<float>(property_y());
- const Atom& existing_x = _node->get_property("ingenui:canvas-x");
- const Atom& existing_y = _node->get_property("ingenui:canvas-y");
+ const LV2URIMap& uris = App::instance().uris();
+
+ const Atom& existing_x = _node->get_property(uris.ingenui_canvas_x);
+ const Atom& existing_y = _node->get_property(uris.ingenui_canvas_y);
if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT
|| existing_x.get_float() != x || existing_y.get_float() != y) {
Shared::Resource::Properties props;
- props.insert(make_pair("ingenui:canvas-x", Atom(x)));
- props.insert(make_pair("ingenui:canvas-y", Atom(y)));
+ props.insert(make_pair(uris.ingenui_canvas_x, Atom(x)));
+ props.insert(make_pair(uris.ingenui_canvas_y, Atom(y)));
App::instance().engine()->put(_node->path(), props);
}
}
@@ -395,18 +391,19 @@ NodeModule::store_location()
void
NodeModule::set_property(const URI& key, const Atom& value)
{
+ const Shared::LV2URIMap& uris = App::instance().uris();
switch (value.type()) {
case Atom::FLOAT:
- if (key.str() == "ingenui:canvas-x") {
+ if (key == uris.ingenui_canvas_x) {
move_to(value.get_float(), property_y());
- } else if (key.str() == "ingenui:canvas-y") {
+ } else if (key == uris.ingenui_canvas_y) {
move_to(property_x(), value.get_float());
}
break;
case Atom::BOOL:
- if (key.str() == "ingen:polyphonic") {
+ if (key == uris.ingen_polyphonic) {
set_stacked_border(value.get_bool());
- } else if (key.str() == "ingen:selected") {
+ } else if (key == uris.ingen_selected) {
if (value.get_bool() != selected()) {
if (value.get_bool())
_canvas.lock()->select_item(shared_from_this());
@@ -422,10 +419,11 @@ NodeModule::set_property(const URI& key, const Atom& value)
void
NodeModule::set_selected(bool b)
{
+ const LV2URIMap& uris = App::instance().uris();
if (b != selected()) {
Module::set_selected(b);
if (App::instance().signal())
- App::instance().engine()->set_property(_node->path(), "ingen:selected", b);
+ App::instance().engine()->set_property(_node->path(), uris.ingen_selected, b);
}
}
diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp
index 781c4359..5151fadc 100644
--- a/src/gui/ObjectMenu.cpp
+++ b/src/gui/ObjectMenu.cpp
@@ -17,6 +17,7 @@
#include <gtkmm.h>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/ObjectModel.hpp"
#include "App.hpp"
#include "ObjectMenu.hpp"
@@ -93,16 +94,18 @@ void
ObjectMenu::on_menu_polyphonic()
{
if (_enable_signal)
- App::instance().engine()->set_property(
- _object->path(), "ingen:polyphonic", bool(_polyphonic_menuitem->get_active()));
+ App::instance().engine()->set_property(_object->path(),
+ App::instance().uris().ingen_polyphonic,
+ bool(_polyphonic_menuitem->get_active()));
}
void
ObjectMenu::property_changed(const URI& predicate, const Atom& value)
{
+ const LV2URIMap& uris = App::instance().uris();
_enable_signal = false;
- if (predicate.str() == "ingen:polyphonic" && value.type() == Atom::BOOL)
+ if (predicate == uris.ingen_polyphonic && value.type() == Atom::BOOL)
_polyphonic_menuitem->set_active(value.get_bool());
_enable_signal = true;
}
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 6e7374d0..45e6ec66 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -22,6 +22,7 @@
#include "flowcanvas/Canvas.hpp"
#include "flowcanvas/Ellipse.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "shared/Builder.hpp"
#include "shared/ClashAvoider.hpp"
#include "serialisation/Serialiser.hpp"
@@ -651,12 +652,14 @@ PatchCanvas::paste()
ClientStore clipboard;
clipboard.set_plugins(App::instance().store()->plugins());
+ const LV2URIMap& uris = App::instance().uris();
+
// mkdir -p
string to_create = _patch->path().chop_scheme().substr(1);
string created = "/";
Resource::Properties props;
- props.insert(make_pair("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Patch")));
- props.insert(make_pair("ingen:polyphony", Raul::Atom(int32_t(_patch->poly()))));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Patch));
+ props.insert(make_pair(uris.ingen_polyphony, Raul::Atom(int32_t(_patch->poly()))));
clipboard.put(Path(), props);
size_t first_slash;
while (to_create != "/" && to_create != ""
@@ -685,18 +688,18 @@ PatchCanvas::paste()
for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) {
if (_patch->path().is_root() && i->first.is_root())
continue;
- GraphObject::Properties::iterator x = i->second->properties().find("ingenui:canvas-x");
+ GraphObject::Properties::iterator x = i->second->properties().find(uris.ingenui_canvas_x);
if (x != i->second->properties().end())
x->second = x->second.get_float() + (20.0f * _paste_count);
- GraphObject::Properties::iterator y = i->second->properties().find("ingenui:canvas-y");
+ GraphObject::Properties::iterator y = i->second->properties().find(uris.ingenui_canvas_y);
if (y != i->second->properties().end())
y->second = y->second.get_float() + (20.0f * _paste_count);
if (i->first.parent().is_root()) {
- GraphObject::Properties::iterator s = i->second->properties().find("ingen:selected");
+ GraphObject::Properties::iterator s = i->second->properties().find(uris.ingen_selected);
if (s != i->second->properties().end())
s->second = true;
else
- i->second->properties().insert(make_pair("ingen:selected", true));
+ i->second->properties().insert(make_pair(uris.ingen_selected, true));
}
builder.build(i->second);
}
@@ -737,18 +740,20 @@ PatchCanvas::generate_port_name(
void
PatchCanvas::menu_add_port(const string& sym_base, const string& name_base,
- const string& type, bool is_output)
+ const Raul::URI& type, bool is_output)
{
string sym, name;
generate_port_name(sym_base, sym, name_base, name);
const Path& path = _patch->path().base() + sym;
+ const LV2URIMap& uris = App::instance().uris();
+
Resource::Properties props = get_initial_data();
- props.insert(make_pair("rdf:type", Atom(Atom::URI, type)));
- props.insert(make_pair("rdf:type",
+ props.insert(make_pair(uris.rdf_type, type));
+ props.insert(make_pair(uris.rdf_type,
Atom(Atom::URI, is_output ? "lv2:OutputPort" : "lv2:InputPort")));
- props.insert(make_pair("lv2:index", Atom(int32_t(_patch->num_ports()))));
- props.insert(make_pair("lv2:name", Atom(name.c_str())));
+ props.insert(make_pair(uris.lv2_index, Atom(int32_t(_patch->num_ports()))));
+ props.insert(make_pair(uris.lv2_name, Atom(name.c_str())));
App::instance().engine()->put(path, props);
}
@@ -760,19 +765,21 @@ PatchCanvas::load_plugin(WeakPtr<PluginModel> weak_plugin)
if (!plugin)
return;
- string name = plugin->default_node_symbol();
- unsigned offset = App::instance().store()->child_name_offset(_patch->path(), name);
+ Raul::Symbol symbol = plugin->default_node_symbol();
+ unsigned offset = App::instance().store()->child_name_offset(_patch->path(), symbol);
if (offset != 0) {
std::stringstream ss;
- ss << name << "_" << offset;
- name = ss.str();
+ ss << symbol << "_" << offset;
+ symbol = ss.str();
}
- const Path path = _patch->path().base() + name;
+ const LV2URIMap& uris = App::instance().uris();
+
+ const Path path = _patch->path().child(symbol);
// FIXME: polyphony?
GraphObject::Properties props = get_initial_data();
- props.insert(make_pair("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Node")));
- props.insert(make_pair("rdf:instanceOf", Raul::Atom(Raul::Atom::URI, plugin->uri().str())));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
+ props.insert(make_pair(uris.rdf_instanceOf, plugin->uri()));
App::instance().engine()->put(path, props);
}
diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp
index 12587c2b..e4cfd1a8 100644
--- a/src/gui/PatchCanvas.hpp
+++ b/src/gui/PatchCanvas.hpp
@@ -93,7 +93,7 @@ private:
void menu_add_port(
const string& sym_base, const string& name_base,
- const string& type, bool is_output);
+ const Raul::URI& type, bool is_output);
void menu_load_plugin();
void menu_new_patch();
diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp
index 6981f2ef..b1a71cf2 100644
--- a/src/gui/PatchPortModule.cpp
+++ b/src/gui/PatchPortModule.cpp
@@ -19,6 +19,7 @@
#include <utility>
#include "PatchPortModule.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/NodeModel.hpp"
#include "App.hpp"
@@ -38,7 +39,7 @@ namespace GUI {
PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortModel> model)
- : FlowCanvas::Module(canvas, model->path().name(), 0, 0, false) // FIXME: coords?
+ : FlowCanvas::Module(canvas, "", 0, 0, false) // FIXME: coords?
, _model(model)
, _human_name_visible(false)
{
@@ -57,7 +58,7 @@ boost::shared_ptr<PatchPortModule>
PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortModel> model, bool human)
{
boost::shared_ptr<PatchPortModule> ret(new PatchPortModule(canvas, model));
- boost::shared_ptr<Port> port(new Port(ret, model, model->symbol(), true));
+ boost::shared_ptr<Port> port(Port::create(ret, model, human, true));
ret->add_port(port);
ret->set_port(port);
@@ -71,11 +72,7 @@ PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortMod
m != model->properties().end(); ++m)
ret->set_property(m->first, m->second);
- if (human)
- ret->show_human_names(human);
- else
- ret->resize();
-
+ ret->resize();
return ret;
}
@@ -97,14 +94,16 @@ PatchPortModule::store_location()
const float x = static_cast<float>(property_x());
const float y = static_cast<float>(property_y());
- const Atom& existing_x = _model->get_property("ingenui:canvas-x");
- const Atom& existing_y = _model->get_property("ingenui:canvas-y");
+ const LV2URIMap& uris = App::instance().uris();
+
+ const Atom& existing_x = _model->get_property(uris.ingenui_canvas_x);
+ const Atom& existing_y = _model->get_property(uris.ingenui_canvas_y);
if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT
|| existing_x.get_float() != x || existing_y.get_float() != y) {
Shared::Resource::Properties props;
- props.insert(make_pair("ingenui:canvas-x", Atom(x)));
- props.insert(make_pair("ingenui:canvas-y", Atom(y)));
+ props.insert(make_pair(uris.ingenui_canvas_x, Atom(x)));
+ props.insert(make_pair(uris.ingenui_canvas_y, Atom(y)));
App::instance().engine()->put(_model->meta_uri(), props);
}
}
@@ -113,13 +112,14 @@ PatchPortModule::store_location()
void
PatchPortModule::show_human_names(bool b)
{
+ const LV2URIMap& uris = App::instance().uris();
using namespace std;
_human_name_visible = b;
- const Atom& name = _model->get_property("lv2:name");
- if (b && name.is_valid())
+ const Atom& name = _model->get_property(uris.lv2_name);
+ if (b && name.type() == Atom::STRING)
set_name(name.get_string());
else
- set_name(_model->symbol());
+ set_name(_model->symbol().c_str());
resize();
}
@@ -136,24 +136,25 @@ PatchPortModule::set_name(const std::string& n)
void
PatchPortModule::set_property(const URI& key, const Atom& value)
{
+ const LV2URIMap& uris = App::instance().uris();
switch (value.type()) {
case Atom::FLOAT:
- if (key.str() == "ingenui:canvas-x") {
+ if (key == uris.ingenui_canvas_x) {
move_to(value.get_float(), property_y());
- } else if (key.str() == "ingenui:canvas-y") {
+ } else if (key == uris.ingenui_canvas_y) {
move_to(property_x(), value.get_float());
}
break;
case Atom::STRING:
- if (key.str() == "lv2:name" && _human_name_visible) {
+ if (key == uris.lv2_name && _human_name_visible) {
set_name(value.get_string());
- } else if (key.str() == "lv2:symbol" && !_human_name_visible) {
+ } else if (key == uris.lv2_symbol && !_human_name_visible) {
set_name(value.get_string());
}
case Atom::BOOL:
- if (key.str() == "ingen:polyphonic") {
+ if (key == uris.ingen_polyphonic) {
set_stacked_border(value.get_bool());
- } else if (key.str() == "ingen:selected") {
+ } else if (key == uris.ingen_selected) {
if (value.get_bool() != selected()) {
if (value.get_bool()) {
_canvas.lock()->select_item(shared_from_this());
@@ -173,7 +174,8 @@ PatchPortModule::set_selected(bool b)
if (b != selected()) {
Module::set_selected(b);
if (App::instance().signal())
- App::instance().engine()->set_property(_model->path(), "ingen:selected", b);
+ App::instance().engine()->set_property(_model->path(),
+ App::instance().uris().ingen_selected, b);
}
}
diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp
index a5884b4b..e85b7c90 100644
--- a/src/gui/PatchPortModule.hpp
+++ b/src/gui/PatchPortModule.hpp
@@ -41,7 +41,7 @@ class Port;
class PortMenu;
-/** A "module" to represent a patch's port on it's own canvas.
+/** A "module" to represent a patch's port on its own canvas.
*
* Translation: This is the nameless single port pseudo module thingy.
*
diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp
index feb0606c..0ccc7344 100644
--- a/src/gui/PatchTreeWindow.cpp
+++ b/src/gui/PatchTreeWindow.cpp
@@ -18,6 +18,7 @@
#include "raul/log.hpp"
#include "raul/Path.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/ClientStore.hpp"
#include "client/PatchModel.hpp"
#include "App.hpp"
@@ -93,7 +94,7 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm)
if (pm->path().is_root()) {
row[_patch_tree_columns.name_col] = App::instance().engine()->uri().str();
} else {
- row[_patch_tree_columns.name_col] = pm->path().name();
+ row[_patch_tree_columns.name_col] = pm->symbol().c_str();
}
row[_patch_tree_columns.enabled_col] = pm->enabled();
row[_patch_tree_columns.patch_model_col] = pm;
@@ -105,7 +106,7 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm)
if (c != children.end()) {
Gtk::TreeModel::iterator iter = _patch_treestore->append(c->children());
Gtk::TreeModel::Row row = *iter;
- row[_patch_tree_columns.name_col] = pm->path().name();
+ row[_patch_tree_columns.name_col] = pm->symbol().c_str();
row[_patch_tree_columns.enabled_col] = pm->enabled();
row[_patch_tree_columns.patch_model_col] = pm;
_patches_treeview->expand_row(_patch_treestore->get_path(iter), true);
@@ -191,7 +192,8 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str)
assert(pm);
if (_enable_signal)
- App::instance().engine()->set_property(pm->path(), "ingen:enabled", (bool)!pm->enabled());
+ App::instance().engine()->set_property(pm->path(),
+ App::instance().uris().ingen_enabled, (bool)!pm->enabled());
}
@@ -199,8 +201,9 @@ void
PatchTreeWindow::patch_property_changed(const URI& key, const Atom& value,
SharedPtr<PatchModel> patch)
{
+ const LV2URIMap& uris = App::instance().uris();
_enable_signal = false;
- if (key.str() == "ingen:enabled" && value.type() == Atom::BOOL) {
+ if (key == uris.ingen_enabled && value.type() == Atom::BOOL) {
Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), patch);
if (i != _patch_treestore->children().end()) {
Gtk::TreeModel::Row row = *i;
@@ -223,7 +226,7 @@ PatchTreeWindow::patch_moved(SharedPtr<PatchModel> patch)
if (i != _patch_treestore->children().end()) {
Gtk::TreeModel::Row row = *i;
- row[_patch_tree_columns.name_col] = patch->path().name();
+ row[_patch_tree_columns.name_col] = patch->symbol().c_str();
} else {
LOG(error) << "Unable to find patch " << patch->path() << endl;
}
diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp
index 6fce3797..434d455c 100644
--- a/src/gui/PatchView.cpp
+++ b/src/gui/PatchView.cpp
@@ -19,6 +19,7 @@
#include <fstream>
#include "raul/log.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "App.hpp"
#include "PatchView.hpp"
@@ -187,7 +188,8 @@ PatchView::process_toggled()
if (!_enable_signal)
return;
- App::instance().engine()->set_property(_patch->path(), "ingen:enabled",
+ App::instance().engine()->set_property(_patch->path(),
+ App::instance().uris().ingen_enabled,
(bool)_process_but->get_active());
}
@@ -195,7 +197,8 @@ PatchView::process_toggled()
void
PatchView::poly_changed()
{
- App::instance().engine()->set_property(_patch->meta().uri(), "ingen:polyphony",
+ App::instance().engine()->set_property(_patch->meta().uri(),
+ App::instance().uris().ingen_polyphony,
_poly_spin->get_value_as_int());
}
@@ -211,7 +214,7 @@ void
PatchView::property_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
_enable_signal = false;
- if (predicate.str() == "ingen:enabled") {
+ if (predicate == App::instance().uris().ingen_enabled) {
if (value.type() == Atom::BOOL)
_process_but->set_active(value.get_bool());
else
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 70cade09..7367b453 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -17,8 +17,9 @@
#include <cassert>
#include "raul/log.hpp"
-#include "interface/EngineInterface.hpp"
#include "flowcanvas/Module.hpp"
+#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/PortModel.hpp"
#include "App.hpp"
@@ -39,6 +40,29 @@ namespace GUI {
ArtVpathDash* Port::_dash;
+
+SharedPtr<Port>
+Port::create(
+ boost::shared_ptr<FlowCanvas::Module> module,
+ SharedPtr<PortModel> pm,
+ bool human_name,
+ bool flip)
+{
+ Glib::ustring label(human_name ? "" : pm->path().symbol());
+ if (human_name) {
+ const Raul::Atom& name = pm->get_property("lv2:name");
+ if (name.type() == Raul::Atom::STRING) {
+ label = name.get_string();
+ } else {
+ const SharedPtr<const NodeModel> parent(PtrCast<const NodeModel>(pm->parent()));
+ if (parent && parent->plugin_model())
+ label = parent->plugin_model()->port_human_name(pm->index());
+ }
+ }
+ return SharedPtr<Port>(new Port(module, pm, label, flip));
+}
+
+
/** @a flip Make an input port appear as an output port, and vice versa.
*/
Port::Port(
@@ -117,7 +141,8 @@ Port::create_menu()
void
Port::moved()
{
- set_name(model()->path().name());
+ if (App::instance().configuration()->name_style() == Configuration::PATH)
+ set_name(model()->symbol().c_str());
module().lock()->resize();
}
@@ -164,18 +189,22 @@ void
Port::set_control(float value, bool signal)
{
if (signal) {
+ App& app = App::instance();
+ Ingen::Shared::World* const world = app.world();
if (model()->type() == PortType::CONTROL) {
- App::instance().engine()->set_property(model()->path(), "ingen:value", Atom(value));
- PatchWindow* pw = App::instance().window_factory()->patch_window(
+ app.engine()->set_property(model()->path(),
+ world->uris->ingen_value, Atom(value));
+ PatchWindow* pw = app.window_factory()->patch_window(
PtrCast<PatchModel>(model()->parent()));
if (!pw)
- pw = App::instance().window_factory()->patch_window(
+ pw = app.window_factory()->patch_window(
PtrCast<PatchModel>(model()->parent()->parent()));
if (pw)
pw->show_port_status(model().get(), value);
} else if (model()->type() == PortType::EVENTS) {
- App::instance().engine()->set_property(model()->path(), "ingen:value",
+ app.engine()->set_property(model()->path(),
+ world->uris->ingen_value,
Atom("<http://example.org/ev#BangEvent>", 0, NULL));
}
}
@@ -187,15 +216,16 @@ Port::set_control(float value, bool signal)
void
Port::property_changed(const URI& key, const Atom& value)
{
+ const LV2URIMap& uris = App::instance().uris();
if (value.type() == Atom::FLOAT) {
- if (key.str() == "ingen:value")
+ if (key == uris.ingen_value && !_pressed)
set_control(value.get_float(), false);
- else if (key.str() == "lv2:minimum")
+ else if (key == uris.lv2_minimum)
set_control_min(value.get_float());
- else if (key.str() == "lv2:maximum")
+ else if (key == uris.lv2_maximum)
set_control_max(value.get_float());
} else if (value.type() == Atom::BOOL) {
- if ((key.str() == "lv2:toggled"))
+ if ((key == uris.lv2_toggled))
set_toggled(value.get_bool());
} else if (value.type() == Atom::URI) {
ArtVpathDash* dash = this->dash();
diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp
index ae105fb0..2d1d21ff 100644
--- a/src/gui/Port.hpp
+++ b/src/gui/Port.hpp
@@ -41,10 +41,11 @@ namespace GUI {
class Port : public FlowCanvas::Port
{
public:
- Port(boost::shared_ptr<FlowCanvas::Module> module,
- SharedPtr<PortModel> pm,
- const std::string& name,
- bool flip=false);
+ static SharedPtr<Port> create(
+ boost::shared_ptr<FlowCanvas::Module> module,
+ SharedPtr<PortModel> pm,
+ bool human_name,
+ bool flip=false);
~Port();
@@ -60,6 +61,11 @@ public:
ArtVpathDash* dash();
private:
+ Port(boost::shared_ptr<FlowCanvas::Module> module,
+ SharedPtr<PortModel> pm,
+ const std::string& name,
+ bool flip=false);
+
void property_changed(const Raul::URI& key, const Raul::Atom& value);
bool on_event(GdkEvent* ev);
diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp
index ffa3422f..d52500bc 100644
--- a/src/gui/PortMenu.cpp
+++ b/src/gui/PortMenu.cpp
@@ -18,6 +18,7 @@
#include <gtkmm.h>
#include "raul/SharedPtr.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/PortModel.hpp"
#include "App.hpp"
@@ -98,27 +99,29 @@ PortMenu::on_menu_disconnect()
void
PortMenu::on_menu_set_min()
{
+ const LV2URIMap& uris = App::instance().uris();
SharedPtr<PortModel> model = PtrCast<PortModel>(_object);
- const Raul::Atom& value = model->get_property("ingen:value");
- std::cout << model->path() << " SET MIN " << value << std::endl;
+ const Raul::Atom& value = model->get_property(uris.ingen_value);
if (value.is_valid())
- App::instance().engine()->set_property(_object->path(), "lv2:minimum", value);
+ App::instance().engine()->set_property(_object->path(), uris.lv2_minimum, value);
}
void
PortMenu::on_menu_set_max()
{
+ const LV2URIMap& uris = App::instance().uris();
SharedPtr<PortModel> model = PtrCast<PortModel>(_object);
- const Raul::Atom& value = model->get_property("ingen:value");
+ const Raul::Atom& value = model->get_property(uris.ingen_value);
if (value.is_valid())
- App::instance().engine()->set_property(_object->path(), "lv2:maximum", value);
+ App::instance().engine()->set_property(_object->path(), uris.lv2_maximum, value);
}
void
PortMenu::on_menu_reset_range()
{
+ const LV2URIMap& uris = App::instance().uris();
SharedPtr<PortModel> model = PtrCast<PortModel>(_object);
SharedPtr<NodeModel> parent = PtrCast<NodeModel>(_object->parent());
@@ -126,10 +129,10 @@ PortMenu::on_menu_reset_range()
parent->default_port_value_range(model, min, max);
if (!isnan(min))
- App::instance().engine()->set_property(_object->path(), "lv2:minimum", min);
+ App::instance().engine()->set_property(_object->path(), uris.lv2_minimum, min);
if (!isnan(max))
- App::instance().engine()->set_property(_object->path(), "lv2:maximum", max);
+ App::instance().engine()->set_property(_object->path(), uris.lv2_maximum, max);
}
diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp
index 8b5af899..14cd9b1f 100644
--- a/src/gui/PortPropertiesWindow.cpp
+++ b/src/gui/PortPropertiesWindow.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include <string>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "client/PluginModel.hpp"
#include "App.hpp"
@@ -94,12 +95,13 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm)
void
PortPropertiesWindow::property_change(const URI& key, const Atom& value)
{
+ const Shared::LV2URIMap& uris = App::instance().uris();
//_enable_signal = false;
if (value.type() == Atom::FLOAT) {
- if (key.str() == "lv2:minimum")
+ if (key == uris.lv2_minimum)
_min_spinner->set_value(value.get_float());
- else if (key.str() == "lv2:maximum")
+ else if (key == uris.lv2_maximum)
_max_spinner->set_value(value.get_float());
}
@@ -155,9 +157,10 @@ PortPropertiesWindow::cancel()
void
PortPropertiesWindow::ok()
{
+ const Shared::LV2URIMap& uris = App::instance().uris();
Shared::Resource::Properties props;
- props.insert(make_pair("lv2:minimum", float(_min_spinner->get_value())));
- props.insert(make_pair("lv2:maximum", float(_max_spinner->get_value())));
+ props.insert(make_pair(uris.lv2_minimum, float(_min_spinner->get_value())));
+ props.insert(make_pair(uris.lv2_maximum, float(_max_spinner->get_value())));
App::instance().engine()->put(_port_model->meta().uri(), props);
hide();
}
diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp
index 32210466..c50ec213 100644
--- a/src/gui/RenameWindow.cpp
+++ b/src/gui/RenameWindow.cpp
@@ -55,7 +55,7 @@ void
RenameWindow::set_object(SharedPtr<ObjectModel> object)
{
_object = object;
- _symbol_entry->set_text(object->path().name());
+ _symbol_entry->set_text(object->path().symbol());
const Atom& name_atom = object->get_property("lv2:name");
_label_entry->set_text(
(name_atom.type() == Atom::STRING) ? name_atom.get_string() : "");
@@ -125,19 +125,22 @@ RenameWindow::cancel_clicked()
void
RenameWindow::ok_clicked()
{
- const string& symbol = _symbol_entry->get_text();
- const string& label = _label_entry->get_text();
- Path path = _object->path();
- const Atom& name_atom = _object->get_property("lv2:name");
-
- if (Path::is_valid_name(symbol) && symbol != _object->path().name()) {
- path = _object->path().parent().base() + symbol;
- App::instance().engine()->move(_object->path(), path);
+ const string& symbol_str = _symbol_entry->get_text();
+ const string& label = _label_entry->get_text();
+ Path path = _object->path();
+ const Atom& name_atom = _object->get_property("lv2:name");
+
+ if (Symbol::is_valid(symbol_str)) {
+ const Symbol& symbol(symbol_str);
+ if (symbol != _object->symbol()) {
+ path = _object->path().parent().child(symbol);
+ App::instance().engine()->move(_object->path(), path);
+ }
}
if (label != "" && (!name_atom.is_valid() || label != name_atom.get_string())) {
App::instance().engine()->set_property(path,
- "lv2:name", Atom(Atom::STRING, label));
+ "lv2:name", Atom(label));
}
hide();
diff --git a/src/gui/UploadPatchWindow.cpp b/src/gui/UploadPatchWindow.cpp
index 08e5b726..300bcc71 100644
--- a/src/gui/UploadPatchWindow.cpp
+++ b/src/gui/UploadPatchWindow.cpp
@@ -238,8 +238,8 @@ UploadPatchWindow::upload_clicked()
Glib::ustring short_name = _short_name_entry->get_text();
GraphObject::Properties extra_rdf;
- extra_rdf.insert(make_pair("lv2:symbol", Atom(Atom::STRING, symbol)));
- extra_rdf.insert(make_pair("doap:name", Atom(Atom::STRING, short_name)));
+ extra_rdf.insert(make_pair("lv2:symbol", symbol));
+ extra_rdf.insert(make_pair("doap:name", short_name));
_response = 0;
_progress_pct = 0;
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index 52d36c70..c50298b9 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -193,7 +193,7 @@ main(int argc, char** argv)
const Path p(path_option.get_string());
if (!p.is_root()) {
parent = p.parent();
- symbol = p.name();
+ symbol = p.symbol();
}
} else {
cerr << "Invalid path given: '" << path_option << endl;
diff --git a/src/module/World.hpp b/src/module/World.hpp
index e1ccf5d1..9f962af1 100644
--- a/src/module/World.hpp
+++ b/src/module/World.hpp
@@ -40,6 +40,7 @@ namespace Shared {
class EngineInterface;
class Store;
class LV2Features;
+class LV2URIMap;
/** The "world" all Ingen modules may share.
@@ -73,6 +74,8 @@ struct World {
SLV2World slv2_world;
LV2Features* lv2_features;
+ boost::shared_ptr<LV2URIMap> uris;
+
boost::shared_ptr<EngineInterface> engine;
boost::shared_ptr<Engine> local_engine;
boost::shared_ptr<Serialisation::Serialiser> serialiser;
diff --git a/src/module/ingen_module.cpp b/src/module/ingen_module.cpp
index 5faefebc..167fd0f2 100644
--- a/src/module/ingen_module.cpp
+++ b/src/module/ingen_module.cpp
@@ -16,10 +16,12 @@
*/
#include "redlandmm/World.hpp"
+#include "uri-map.lv2/uri-map.h"
+#include "ingen-config.h"
#include "shared/LV2Features.hpp"
+#include "shared/LV2URIMap.hpp"
#include "ingen_module.hpp"
#include "World.hpp"
-#include "ingen-config.h"
#ifdef HAVE_SLV2
#include "slv2/slv2.h"
#endif
@@ -39,7 +41,12 @@ ingen_get_world()
#ifdef HAVE_SLV2
world->slv2_world = slv2_world_new_using_rdf_world(world->rdf_world->world());
world->lv2_features = new Ingen::Shared::LV2Features();
+ world->uris = PtrCast<Ingen::Shared::LV2URIMap>(
+ world->lv2_features->feature(LV2_URI_MAP_URI));
slv2_world_load_all(world->slv2_world);
+#else
+ world->uris = SharedPtr<Ingen::Shared::LV2URIMap>(
+ new Ingen::Shared::LV2URIMap());
#endif
world->engine.reset();
world->local_engine.reset();
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 24da2567..835057bc 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -26,6 +26,7 @@
#include "raul/Atom.hpp"
#include "raul/AtomRDF.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "Parser.hpp"
#define LOG(s) s << "[Parser] "
@@ -208,7 +209,7 @@ Parser::parse_update(
const string obj_path = (*i)["path"].to_string();
const Redland::Node& val_node = (*i)["value"];
const Atom a(AtomRDF::node_to_atom(val_node));
- target->set_property(obj_path, "ingen:value", a);
+ target->set_property(obj_path, world->uris->ingen_value, a);
}
return parse(world, target, model, base_uri, data_path, parent, symbol, data);
@@ -279,8 +280,8 @@ Parser::parse(
}
string path = (parent && symbol)
- ? parent->base() + *symbol
- : (parent ? parent->base() : "/") + path_str.substr(path_str.find("/")+1);
+ ? parent->child(*symbol).str()
+ : (parent ? *parent : Path("/")).child(path_str.substr(path_str.find("/")+1)).str();
if (!Path::is_valid(path)) {
LOG(warn) << "Invalid path '" << path << "' transformed to /" << endl;
@@ -307,7 +308,7 @@ Parser::parse(
string subject_str = subject.to_string();
if (URI::is_valid(subject_str)) {
if (subject == document_uri)
- subject_str = Path::root_uri;
+ subject_str = Path::root.str();
parse_properties(world, target, model, subject, subject_str);
}
}
@@ -364,7 +365,7 @@ Parser::parse_patch(
string symbol;
if (a_symbol) {
- symbol = *a_symbol;
+ symbol = a_symbol->c_str();
} else { // Guess symbol from base URI (filename) if we need to
symbol = base_uri.substr(base_uri.find_last_of("/") + 1);
symbol = symbol.substr(0, symbol.find("."));
@@ -470,7 +471,7 @@ Parser::parse_patch(
Resources::iterator res_i = resources.find(type_i->second);
if (res_i == resources.end())
continue;
- parse_patch(world, target, model, res_i->second, patch_path, Symbol(node_path.name()));
+ parse_patch(world, target, model, res_i->second, patch_path, Symbol(node_path.symbol()));
Glib::Mutex::Lock lock(world->rdf_world->mutex());
target->put(node_path, i->second);
}
@@ -513,7 +514,7 @@ Parser::parse_patch(
const Path node_path(relative_uri(base_uri, node_uri, true));
const Symbol port_sym = port_uri.substr(node_uri.length() + 1);
- const Path port_path = node_path.base() + port_sym;
+ const Path port_path = node_path.child(port_sym);
const string key = world->rdf_world->qualify((*i)["key"].to_string());
p->second.insert(make_pair(key, AtomRDF::node_to_atom((*i)["val"])));
}
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 97b84e4e..86264900 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -45,6 +45,7 @@
#include "interface/Port.hpp"
#include "interface/Connection.hpp"
#include "shared/ResourceImpl.hpp"
+#include "shared/LV2URIMap.hpp"
#include "Serialiser.hpp"
#define LOG(s) s << "[Serialiser] "
@@ -65,7 +66,7 @@ namespace Serialisation {
Serialiser::Serialiser(Shared::World& world, SharedPtr<Shared::Store> store)
: _root_path("/")
, _store(store)
- , _world(*world.rdf_world)
+ , _world(world)
{
}
@@ -176,7 +177,7 @@ Serialiser::start_to_filename(const string& filename)
_base_uri = "file://" + filename;
else
_base_uri = filename;
- _model = new Redland::Model(_world);
+ _model = new Redland::Model(*_world.rdf_world);
_model->set_base_uri(_base_uri);
_mode = TO_FILE;
}
@@ -199,7 +200,7 @@ Serialiser::start_to_string(const Raul::Path& root, const string& base_uri)
_root_path = root;
_base_uri = base_uri;
- _model = new Redland::Model(_world);
+ _model = new Redland::Model(*_world.rdf_world);
_model->set_base_uri(base_uri);
_mode = TO_STRING;
}
@@ -314,7 +315,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node&
// Otherwise take the one from our path (if possible)
} else if (!patch->path().is_root()) {
_model->add_statement(patch_id, "lv2:symbol",
- Redland::Literal(_model->world(), patch->path().name()));
+ Redland::Literal(_model->world(), patch->path().symbol()));
} else {
LOG(warn) << "Patch has no lv2:symbol" << endl;
}
@@ -354,7 +355,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node&
// Ensure lv2:name always exists so Patch is a valid LV2 plugin
if (p->properties().find("lv2:name") == p->properties().end())
- p->set_property("lv2:name", Atom(Atom::STRING, p->symbol()));
+ p->set_property("lv2:name", Atom(p->symbol().c_str()));
_model->add_statement(patch_id, "lv2:port", port_id);
serialise_port_meta(p, port_id);
@@ -390,7 +391,7 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node,
_model->add_statement(node_id, "rdf:instanceOf",
class_id);
_model->add_statement(node_id, "lv2:symbol",
- Redland::Literal(_model->world(), node->path().name()));
+ Redland::Literal(_model->world(), node->path().symbol()));
serialise_properties(node_id, &node->meta(), node->properties());
@@ -476,7 +477,7 @@ Serialiser::serialise_connection(SharedPtr<GraphObject> parent,
? instance_rdf_node(connection->dst_port_path())
: class_rdf_node(connection->dst_port_path());
- const Redland::Node connection_node = _world.blank_id();
+ const Redland::Node connection_node = _world.rdf_world->blank_id();
_model->add_statement(connection_node, "ingen:source", src_node);
_model->add_statement(connection_node, "ingen:destination", dst_node);
if (parent) {
diff --git a/src/serialisation/Serialiser.hpp b/src/serialisation/Serialiser.hpp
index b4e148e1..757f5efb 100644
--- a/src/serialisation/Serialiser.hpp
+++ b/src/serialisation/Serialiser.hpp
@@ -112,7 +112,7 @@ private:
SharedPtr<Shared::Store> _store;
Mode _mode;
std::string _base_uri;
- Redland::World& _world;
+ Shared::World& _world;
Redland::Model* _model;
#ifdef USE_BLANK_NODES
diff --git a/src/shared/Builder.cpp b/src/shared/Builder.cpp
index 37c193fb..fd94ddd0 100644
--- a/src/shared/Builder.cpp
+++ b/src/shared/Builder.cpp
@@ -16,13 +16,16 @@
*/
#include "raul/Atom.hpp"
-#include "Builder.hpp"
#include "common/interface/CommonInterface.hpp"
#include "common/interface/Patch.hpp"
#include "common/interface/Node.hpp"
#include "common/interface/Port.hpp"
#include "common/interface/Connection.hpp"
#include "common/interface/Plugin.hpp"
+#include "module/ingen_module.hpp"
+#include "module/World.hpp"
+#include "shared/LV2URIMap.hpp"
+#include "Builder.hpp"
using namespace std;
using namespace Raul;
@@ -40,12 +43,13 @@ Builder::Builder(CommonInterface& interface)
void
Builder::build(SharedPtr<const GraphObject> object)
{
+ const LV2URIMap& uris = *ingen_get_world()->uris.get();
SharedPtr<const Patch> patch = PtrCast<const Patch>(object);
if (patch) {
if (!object->path().is_root()) {
Resource::Properties props;
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Patch")));
- props.insert(make_pair("ingen:polyphony", Atom(int32_t(patch->internal_polyphony()))));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Patch));
+ props.insert(make_pair(uris.ingen_polyphony, Atom(int32_t(patch->internal_polyphony()))));
_interface.put(object->path(), props);
}
@@ -60,8 +64,8 @@ Builder::build(SharedPtr<const GraphObject> object)
SharedPtr<const Node> node = PtrCast<const Node>(object);
if (node) {
Resource::Properties props;
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Node")));
- props.insert(make_pair("rdf:instanceOf", Atom(Atom::URI, node->plugin()->uri().str())));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
+ props.insert(make_pair(uris.rdf_instanceOf, node->plugin()->uri()));
_interface.put(node->path(), props);
build_object(object);
return;
diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp
index f5777e04..a3e54957 100644
--- a/src/shared/ClashAvoider.cpp
+++ b/src/shared/ClashAvoider.cpp
@@ -45,9 +45,9 @@ ClashAvoider::map_path(const Raul::Path& in)
unsigned offset = 0;
bool has_offset = false;
- size_t pos = in.find_last_of("_");
+ const size_t pos = in.find_last_of('_');
if (pos != string::npos && pos != (in.length()-1)) {
- const std::string trailing = in.substr(in.find_last_of("_")+1);
+ const std::string trailing = in.substr(pos + 1);
has_offset = (sscanf(trailing.c_str(), "%u", &offset) > 0);
}
@@ -56,7 +56,7 @@ ClashAvoider::map_path(const Raul::Path& in)
// Path without _n suffix
Path base_path = in;
if (has_offset)
- base_path = base_path.substr(0, base_path.find_last_of("_"));
+ base_path = base_path.substr(0, base_path.find_last_of('_'));
debug << "BASE: " << base_path << endl;
@@ -108,7 +108,7 @@ ClashAvoider::map_path(const Raul::Path& in)
std::stringstream ss;
ss << base_path << "_" << offset;
if (!exists(ss.str())) {
- const string name = (base_path.length() > 1) ? base_path.name() : "_";
+ const string name = (base_path.length() > 1) ? base_path.symbol() : "_";
string str = ss.str();
InsertRecord i = _symbol_map.insert(make_pair(in, str));
debug << "HIT: offset = " << offset << ", str = " << str << endl;
diff --git a/src/shared/LV2Features.cpp b/src/shared/LV2Features.cpp
index b57f1117..5088d6e0 100644
--- a/src/shared/LV2Features.cpp
+++ b/src/shared/LV2Features.cpp
@@ -27,10 +27,7 @@ namespace Shared {
LV2Features::LV2Features()
-// : _lv2_features((LV2_Feature**)malloc(sizeof(LV2_Feature*)))
{
-// _lv2_features[0] = NULL;
-
add_feature(LV2_URI_MAP_URI, SharedPtr<Feature>(new LV2URIMap()));
}
diff --git a/src/shared/LV2Features.hpp b/src/shared/LV2Features.hpp
index 84b737f6..ff6d7b1d 100644
--- a/src/shared/LV2Features.hpp
+++ b/src/shared/LV2Features.hpp
@@ -18,16 +18,12 @@
#ifndef INGEN_SHARED_LV2FEATURES_HPP
#define INGEN_SHARED_LV2FEATURES_HPP
-#include "ingen-config.h"
-#ifndef HAVE_SLV2
-#error "This file requires SLV2, but HAVE_SLV2 is not defined. Please report."
-#endif
-
#include <map>
#include <string>
#include <vector>
-#include "slv2/slv2.h"
+#include "lv2.h"
#include "raul/SharedPtr.hpp"
+#include "ingen-config.h"
namespace Ingen {
namespace Shared {
diff --git a/src/shared/LV2Object.cpp b/src/shared/LV2Object.cpp
index 16e8ff71..193e2c1d 100644
--- a/src/shared/LV2Object.cpp
+++ b/src/shared/LV2Object.cpp
@@ -35,18 +35,18 @@ namespace LV2Object {
bool
to_atom(World* world, const LV2_Object* object, Raul::Atom& atom)
{
- SharedPtr<LV2URIMap> map = PtrCast<LV2URIMap>(world->lv2_features->feature(LV2_URI_MAP_URI));
+ SharedPtr<LV2URIMap> uris = world->uris;
- if (object->type == map->object_class_string) {
+ if (object->type == uris->object_class_string.id) {
atom = Raul::Atom((char*)(object + 1));
return true;
- } else if (object->type == map->object_class_bool) {
+ } else if (object->type == uris->object_class_bool.id) {
atom = Raul::Atom((bool)(int32_t*)(object + 1));
return true;
- } else if (object->type == map->object_class_int32) {
+ } else if (object->type == uris->object_class_int32.id) {
atom = Raul::Atom((int32_t*)(object + 1));
return true;
- } else if (object->type == map->object_class_float32) {
+ } else if (object->type == uris->object_class_float32.id) {
atom = Raul::Atom((float*)(object + 1));
return true;
}
@@ -60,22 +60,22 @@ to_atom(World* world, const LV2_Object* object, Raul::Atom& atom)
bool
from_atom(World* world, const Raul::Atom& atom, LV2_Object* object)
{
- SharedPtr<LV2URIMap> map = PtrCast<LV2URIMap>(world->lv2_features->feature(LV2_URI_MAP_URI));
+ SharedPtr<LV2URIMap> uris = world->uris;
char* str;
switch (atom.type()) {
case Raul::Atom::FLOAT:
- object->type = map->object_class_float32;
+ object->type = uris->object_class_float32.id;
object->size = sizeof(float);
*(float*)(object + 1) = atom.get_float();
break;
case Raul::Atom::INT:
- object->type = map->object_class_int32;
+ object->type = uris->object_class_int32.id;
object->size = sizeof(int32_t);
*(int32_t*)(object + 1) = atom.get_int32();
break;
case Raul::Atom::STRING:
- object->type = map->object_class_string;
+ object->type = uris->object_class_string.id;
object->size = std::min((uint16_t)object->size, (uint16_t)(strlen(atom.get_string()) + 1));
str = ((char*)(object + 1));
str[object->size - 1] = '\0';
@@ -83,8 +83,8 @@ from_atom(World* world, const Raul::Atom& atom, LV2_Object* object)
break;
case Raul::Atom::BLOB:
error << "TODO: Blob support" << endl;
- /*object->type = map->object_class_string;
- *(uint16_t*)(object + 1) = map->uri_to_id(NULL, atom.get_blob_type());
+ /*object->type = uris->object_class_string;
+ *(uint16_t*)(object + 1) = uris->uri_to_id(NULL, atom.get_blob_type());
memcpy(((char*)(object + 1) + sizeof(uint32_t)), atom.get_blob(),
std::min(atom.data_size(), (size_t)object->size));*/
default:
diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp
index d0c71acf..37856fe6 100644
--- a/src/shared/LV2URIMap.cpp
+++ b/src/shared/LV2URIMap.cpp
@@ -30,16 +30,49 @@ namespace Ingen {
namespace Shared {
+LV2URIMap::Quark::Quark(const char* c_str)
+ : Raul::URI(c_str)
+ , id(g_quark_from_string(c_str))
+{
+}
+
+
LV2URIMap::LV2URIMap()
- : object_class_bool(uri_to_id(NULL, LV2_OBJECT_URI "#Bool"))
- , object_class_string(uri_to_id(NULL, LV2_OBJECT_URI "#String"))
- , object_class_int32(uri_to_id(NULL, LV2_OBJECT_URI "#Int32"))
- , object_class_float32(uri_to_id(NULL, LV2_OBJECT_URI "#Float32"))
- , object_class_vector(uri_to_id(NULL, LV2_OBJECT_URI "#Vector"))
- , ui_format_events(uri_to_id(NULL, "http://lv2plug.in/ns/extensions/ui#Events"))
- , midi_event(uri_to_id(NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent"))
- , string_transfer(uri_to_id(NULL, "http://lv2plug.in/ns/dev/string-port#StringTransfer"))
- , object_transfer(uri_to_id(NULL, LV2_OBJECT_URI "#ObjectTransfer"))
+ : ctx_context("ctx:context")
+ , ctx_AudioContext("ctx:AudioContext")
+ , ctx_MessageContext("ctx:MessageContext")
+ , doap_name("doap:name")
+ , ingen_LADSPAPlugin("ingen:LADSPAPlugin")
+ , ingen_Internal("ingen:Internal")
+ , ingen_Node("ingen:Node")
+ , ingen_Patch("ingen:Patch")
+ , ingen_Port("ingen:Port")
+ , ingen_broadcast("ingen:broadcast")
+ , ingen_enabled("ingen:enabled")
+ , ingen_polyphonic("ingen:polyphonic")
+ , ingen_polyphony("ingen:polyphony")
+ , ingen_selected("ingen:selected")
+ , ingen_value("ingen:value")
+ , ingenui_canvas_x("ingenui:canvas-x")
+ , ingenui_canvas_y("ingenui:canvas-y")
+ , lv2_Plugin("lv2:Plugin")
+ , lv2_index("lv2:index")
+ , lv2_maximum("lv2:maximum")
+ , lv2_minimum("lv2:minimum")
+ , lv2_name("lv2:name")
+ , lv2_symbol("lv2:symbol")
+ , lv2_toggled("lv2:toggled")
+ , midi_event("http://lv2plug.in/ns/ext/midi#MidiEvent")
+ , object_class_bool(LV2_OBJECT_URI "#Bool")
+ , object_class_float32(LV2_OBJECT_URI "#Float32")
+ , object_class_int32(LV2_OBJECT_URI "#Int32")
+ , object_class_string(LV2_OBJECT_URI "#String")
+ , object_class_vector(LV2_OBJECT_URI "#Vector")
+ , object_transfer(LV2_OBJECT_URI "#ObjectTransfer")
+ , rdf_instanceOf("rdf:instanceOf")
+ , rdf_type("rdf:type")
+ , string_transfer("http://lv2plug.in/ns/dev/string-port#StringTransfer")
+ , ui_format_events("http://lv2plug.in/ns/extensions/ui#Events")
{
uri_map_feature_data.uri_to_id = &LV2URIMap::uri_map_uri_to_id;
uri_map_feature_data.callback_data = this;
diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp
index b1e6a89f..df9a1358 100644
--- a/src/shared/LV2URIMap.hpp
+++ b/src/shared/LV2URIMap.hpp
@@ -18,16 +18,10 @@
#ifndef INGEN_SHARED_LV2URIMAP_HPP
#define INGEN_SHARED_LV2URIMAP_HPP
-#include "ingen-config.h"
-#ifndef HAVE_SLV2
-#error "This file requires SLV2, but HAVE_SLV2 is not defined. Please report."
-#endif
-
-#include <map>
-#include <string>
#include <boost/utility.hpp>
-#include "slv2/slv2.h"
+#include <raul/URI.hpp>
#include "uri-map.lv2/uri-map.h"
+#include "ingen-config.h"
#include "LV2Features.hpp"
namespace Ingen {
@@ -55,15 +49,46 @@ private:
LV2_URI_Map_Feature uri_map_feature_data;
public:
- const uint32_t object_class_bool;
- const uint32_t object_class_string;
- const uint32_t object_class_int32;
- const uint32_t object_class_float32;
- const uint32_t object_class_vector;
- const uint32_t ui_format_events;
- const uint32_t midi_event;
- const uint32_t string_transfer;
- const uint32_t object_transfer;
+ struct Quark : public Raul::URI {
+ Quark(const char* str);
+ uint32_t id;
+ };
+
+ const Quark ctx_context;
+ const Quark ctx_AudioContext;
+ const Quark ctx_MessageContext;
+ const Quark doap_name;
+ const Quark ingen_LADSPAPlugin;
+ const Quark ingen_Internal;
+ const Quark ingen_Node;
+ const Quark ingen_Patch;
+ const Quark ingen_Port;
+ const Quark ingen_broadcast;
+ const Quark ingen_enabled;
+ const Quark ingen_polyphonic;
+ const Quark ingen_polyphony;
+ const Quark ingen_selected;
+ const Quark ingen_value;
+ const Quark ingenui_canvas_x;
+ const Quark ingenui_canvas_y;
+ const Quark lv2_Plugin;
+ const Quark lv2_index;
+ const Quark lv2_maximum;
+ const Quark lv2_minimum;
+ const Quark lv2_name;
+ const Quark lv2_symbol;
+ const Quark lv2_toggled;
+ const Quark midi_event;
+ const Quark object_class_bool;
+ const Quark object_class_float32;
+ const Quark object_class_int32;
+ const Quark object_class_string;
+ const Quark object_class_vector;
+ const Quark object_transfer;
+ const Quark rdf_instanceOf;
+ const Quark rdf_type;
+ const Quark string_transfer;
+ const Quark ui_format_events;
};
diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp
index f5e6e4da..eb80a46c 100644
--- a/src/shared/ResourceImpl.hpp
+++ b/src/shared/ResourceImpl.hpp
@@ -32,8 +32,8 @@ class ResourceImpl : virtual public Resource
public:
ResourceImpl(const Raul::URI& uri) : _uri(uri) {}
- virtual void set_uri(const Raul::URI& uri) { _uri = uri; }
- virtual const Raul::URI uri() const { return _uri.str(); }
+ virtual void set_uri(const Raul::URI& uri) { _uri = uri; }
+ virtual const Raul::URI& uri() const { return _uri; }
const Properties& properties() const { return _properties; }
Properties& properties() { return _properties; }