summaryrefslogtreecommitdiffstats
path: root/src/libs/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-20 03:33:33 +0000
committerDavid Robillard <d@drobilla.net>2007-09-20 03:33:33 +0000
commitc4a88de11f5a4c08418523a1f0fd0634b2f56857 (patch)
treebd94411c87e5c2b8cdb25bad49141cfcf08f97d8 /src/libs/serialisation
parent8e747504412c62f27c599f3f5e001ff3e2e36a82 (diff)
downloadingen-c4a88de11f5a4c08418523a1f0fd0634b2f56857.tar.gz
ingen-c4a88de11f5a4c08418523a1f0fd0634b2f56857.tar.bz2
ingen-c4a88de11f5a4c08418523a1f0fd0634b2f56857.zip
Fix serialization of node polyphonic value.
Fix loading of patches with more than one node (whoops...). git-svn-id: http://svn.drobilla.net/lad/ingen@738 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/serialisation')
-rw-r--r--src/libs/serialisation/Loader.cpp46
1 files changed, 19 insertions, 27 deletions
diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp
index 792d19dd..9438583a 100644
--- a/src/libs/serialisation/Loader.cpp
+++ b/src/libs/serialisation/Loader.cpp
@@ -117,52 +117,44 @@ Loader::load(SharedPtr<EngineInterface> engine,
RDF::Query query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?name ?plugin ?floatkey ?floatval ?poly WHERE {\n") +
- patch_uri + " ingen:node ?node .\n"
- "?node ingen:name ?name ;\n"
- " ingen:plugin ?plugin .\n"
+ patch_uri + " ingen:node ?node .\n"
+ "?node ingen:name ?name ;\n"
+ " ingen:plugin ?plugin ;\n"
+ " ingen:polyphonic ?poly .\n"
"OPTIONAL { ?node ?floatkey ?floatval . \n"
" FILTER ( datatype(?floatval) = xsd:decimal ) }\n"
- "OPTIONAL { ?node ?polyphonic ?poly }\n"
"}");
RDF::Query::Results results = query.run(*rdf_world, model);
- string node_name;
- string node_plugin;
- bool node_polyphonic = false;
map<const string, const Atom> metadata;
- /* Get all node information */
for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
- if (node_name.length() == 0)
- node_name = (*i)["name"].to_string();
+ const string node_name = (*i)["name"].to_string();
+ const Path node_path = patch_path.base() + node_name;
- if (node_plugin.length() == 0)
- node_plugin = rdf_world->qualify((*i)["plugin"].to_string());
+ if (created.find(node_path) == created.end()) {
+ const string node_plugin = rdf_world->qualify((*i)["plugin"].to_string());
+ bool node_polyphonic = false;
- RDF::Node poly_node = (*i)["poly"];
- if (poly_node.is_bool() && poly_node.to_bool() == true)
- node_polyphonic = true;
+ RDF::Node poly_node = (*i)["poly"];
+ if (poly_node.is_bool() && poly_node.to_bool() == true)
+ node_polyphonic = true;
+
+ engine->create_node(node_path, node_plugin, node_polyphonic);
+ created.insert(node_path);
+ }
+ /* Float metadata (FIXME: use using raw predicates is definitely a very
+ * bad idea, make an ingen:Variable or something */
const string floatkey = rdf_world->prefixes().qualify((*i)["floatkey"].to_string());
RDF::Node val_node = (*i)["floatval"];
if (floatkey != "" && val_node.is_float())
- metadata.insert(make_pair(floatkey, Atom(val_node.to_float())));
+ engine->set_metadata(node_path, floatkey, val_node.to_float());
}
- const Path node_path = patch_path.base() + node_name;
-
- /* Create node */
- if (created.find(node_path) == created.end()) {
- engine->create_node(node_path, node_plugin, node_polyphonic);
- created.insert(node_path);
- }
-
- /* Set node metadata */
- for (map<const string, const Atom>::const_iterator i = metadata.begin(); i != metadata.end(); ++i)
- engine->set_metadata(patch_path.base() + node_name, i->first, i->second);
/* Load subpatches */