summaryrefslogtreecommitdiffstats
path: root/src/client/DeprecatedLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/DeprecatedLoader.cpp')
-rw-r--r--src/client/DeprecatedLoader.cpp60
1 files changed, 33 insertions, 27 deletions
diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp
index ec603760..8d774e17 100644
--- a/src/client/DeprecatedLoader.cpp
+++ b/src/client/DeprecatedLoader.cpp
@@ -29,6 +29,7 @@
#include <libxml/xpath.h>
#include "raul/log.hpp"
#include "raul/Path.hpp"
+#include "shared/LV2URIMap.hpp"
#include "interface/EngineInterface.hpp"
#include "DeprecatedLoader.hpp"
@@ -224,13 +225,15 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
size_t poly = 0;
+ const LV2URIMap& uris = Shared::LV2URIMap::instance();
+
/* Use parameter overridden polyphony, if given */
- GraphObject::Properties::iterator poly_param = initial_data.find("ingen:polyphony");
+ GraphObject::Properties::iterator poly_param = initial_data.find(uris.ingen_polyphony);
if (poly_param != initial_data.end() && poly_param->second.type() == Atom::INT)
poly = poly_param->second.get_int32();
- if (initial_data.find("filename") == initial_data.end())
- initial_data.insert(make_pair("filename", Atom(filename.c_str()))); // FIXME: URL?
+ if (initial_data.find(uris.ingen_document) == initial_data.end())
+ initial_data.insert(make_pair(uris.ingen_document, filename));
xmlDocPtr doc = xmlParseFile(filename.c_str());
@@ -294,8 +297,8 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
// Create it, if we're not merging
if (!existing && !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)poly)));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Patch));
+ props.insert(make_pair(uris.ingen_polyphony, Atom((int32_t)poly)));
_engine->put(path, props);
for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i)
_engine->set_property(path, i->first, i->second);
@@ -340,7 +343,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
for ( ; i != pm->controls().end(); ++i) {
const float value = i->value();
_engine->set_property(translate_load_path(i->port_path().str()),
- "ingen:value", Atom(value));
+ uris.ingen_value, Atom(value));
}
} else {
LOG(warn) << "Unknown preset `" << pm->name() << "'" << endl;
@@ -357,7 +360,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename,
// _engine->set_property(subject, i->first, i->second);
if (!existing)
- _engine->set_property(path, "ingen:enabled", (bool)true);
+ _engine->set_property(path, uris.ingen_enabled, (bool)true);
_load_path_translations.clear();
@@ -451,38 +454,40 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
return false;
}
+ const LV2URIMap& uris = Shared::LV2URIMap::instance();
+
// Compatibility hacks for old patches that represent patch ports as nodes
if (plugin_uri == "") {
bool is_port = false;
Resource::Properties props;
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Patch")));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Patch));
if (plugin_type == "Internal") {
is_port = true;
if (plugin_label == "audio_input") {
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:AudioPort")));
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:InputPort")));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_AudioPort));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_InputPort));
_engine->put(path, props);
} else if (plugin_label == "audio_output") {
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:AudioPort")));
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:OutputPort")));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_AudioPort));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort));
_engine->put(path, props);
} else if (plugin_label == "control_input") {
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:ControlPort")));
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:InputPort")));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_ControlPort));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_InputPort));
_engine->put(path, props);
} else if (plugin_label == "control_output" ) {
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:ControlPort")));
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:OutputPort")));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_ControlPort));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort));
_engine->put(path, props);
} else if (plugin_label == "midi_input") {
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2ev:EventPort")));
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:InputPort")));
+ props.insert(make_pair(uris.rdf_type, uris.lv2ev_EventPort));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_InputPort));
_engine->put(path, props);
} else if (plugin_label == "midi_output" ) {
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2ev:EventPort")));
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "lv2:OutputPort")));
+ props.insert(make_pair(uris.rdf_type, uris.lv2ev_EventPort));
+ props.insert(make_pair(uris.rdf_type, uris.lv2_OutputPort));
_engine->put(path, props);
} else {
is_port = false;
@@ -528,11 +533,11 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
plugin_uri = "om:" + plugin_type + ":" + library_name + ":" + plugin_label;
Resource::Properties props;
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Node")));
- props.insert(make_pair("rdf:instanceOf", Atom(Atom::URI, plugin_uri)));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
+ props.insert(make_pair(uris.rdf_instanceOf, Atom(Atom::URI, plugin_uri)));
_engine->put(path, props);
- _engine->set_property(path, "ingen:polyphonic", bool(polyphonic));
+ _engine->set_property(path, uris.ingen_polyphonic, bool(polyphonic));
for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i)
_engine->set_property(path, i->first, i->second);
@@ -543,10 +548,10 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr
// Not deprecated
} else {
Resource::Properties props;
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Node")));
- props.insert(make_pair("rdf:instanceOf", Atom(Atom::URI, plugin_uri)));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
+ props.insert(make_pair(uris.rdf_instanceOf, Atom(Atom::URI, plugin_uri)));
_engine->put(path, props);
- _engine->set_property(path, "ingen:polyphonic", bool(polyphonic));
+ _engine->set_property(path, uris.ingen_polyphonic, bool(polyphonic));
for (GraphObject::Properties::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i)
_engine->set_property(path, i->first, i->second);
return true;
@@ -567,6 +572,7 @@ DeprecatedLoader::load_subpatch(const string& base_filename, const Path& parent,
size_t poly = 0;
GraphObject::Properties initial_data;
+ const LV2URIMap& uris = Shared::LV2URIMap::instance();
while (cur != NULL) {
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
@@ -574,7 +580,7 @@ DeprecatedLoader::load_subpatch(const string& base_filename, const Path& parent,
if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) {
name = (const char*)key;
} else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) {
- initial_data.insert(make_pair("ingen::polyphony", (int)poly));
+ initial_data.insert(make_pair(uris.ingen_polyphony, (int)poly));
} else if ((!xmlStrcmp(cur->name, (const xmlChar*)"filename"))) {
filename = base_filename + "/" + (const char*)key;
} else { // Don't know what this tag is, add it as variable