diff options
author | David Robillard <d@drobilla.net> | 2007-09-19 20:21:12 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-09-19 20:21:12 +0000 |
commit | a054212abbdb26e03ca42c91d0c86819d445bc5f (patch) | |
tree | e141854bfdd44729f66b6a29a3b81936daac0edf | |
parent | 3cec9fedc575aab5a3d625fc1de7649551b9531e (diff) | |
download | ingen-a054212abbdb26e03ca42c91d0c86819d445bc5f.tar.gz ingen-a054212abbdb26e03ca42c91d0c86819d445bc5f.tar.bz2 ingen-a054212abbdb26e03ca42c91d0c86819d445bc5f.zip |
Fix various serialization problems.
git-svn-id: http://svn.drobilla.net/lad/ingen@731 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | patches/saw_lp.ingen.ttl | 1 | ||||
-rw-r--r-- | src/libs/client/Serializer.cpp | 13 | ||||
-rw-r--r-- | src/libs/engine/LV2Node.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/Port.cpp | 2 | ||||
-rw-r--r-- | src/libs/serialisation/Loader.cpp | 40 |
5 files changed, 43 insertions, 15 deletions
diff --git a/patches/saw_lp.ingen.ttl b/patches/saw_lp.ingen.ttl index bd45aefe..3464dc04 100644 --- a/patches/saw_lp.ingen.ttl +++ b/patches/saw_lp.ingen.ttl @@ -23,6 +23,7 @@ ingenuity:canvas-y 1172.5; ingen:plugin <ladspa:1668>; ingen:name "voice_amp"; + ingen:polyphonic true; a "ingen:Node" ], [ ingenuity:canvas-x 1374.0; diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index bfcdc51c..d3d3abfd 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -337,7 +337,7 @@ Serializer::serialize_node(SharedPtr<NodeModel> node, const Node& node_id) _model->add_statement( node_id, "rdf:type", - "ingen:Node"); + Node(_model->world(), Node::RESOURCE, "ingen:Node")); _model->add_statement( node_id, @@ -348,6 +348,11 @@ Serializer::serialize_node(SharedPtr<NodeModel> node, const Node& node_id) node_id, "ingen:plugin", plugin_id); + + _model->add_statement( + node_id, + "ingen:polyphonic", + node->polyphonic()); //serialize_plugin(node->plugin()); @@ -380,9 +385,11 @@ void Serializer::serialize_port(SharedPtr<PortModel> port, const Node& port_id) { if (port->is_input()) - _model->add_statement(port_id, "rdf:type", "ingen:InputPort"); + _model->add_statement(port_id, "rdf:type", + Node(_model->world(), Node::RESOURCE, "ingen:InputPort")); else - _model->add_statement(port_id, "rdf:type", "ingen:OutputPort"); + _model->add_statement(port_id, "rdf:type", + Node(_model->world(), Node::RESOURCE, "ingen:OutputPort")); _model->add_statement(port_id, "ingen:name", Atom(port->path().name().c_str())); diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 7e56c64d..1ab03578 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -192,7 +192,7 @@ LV2Node::~LV2Node() for (uint32_t i=0; i < _poly; ++i) slv2_instance_free((*_instances)[i]); - delete[] _instances; + delete _instances; } diff --git a/src/libs/engine/Port.cpp b/src/libs/engine/Port.cpp index 0a4c9f06..bcf47e90 100644 --- a/src/libs/engine/Port.cpp +++ b/src/libs/engine/Port.cpp @@ -53,6 +53,8 @@ Port::~Port() { for (uint32_t i=0; i < _poly; ++i) delete _buffers->at(i); + + delete _buffers; } diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp index e34b5503..1602ed6f 100644 --- a/src/libs/serialisation/Loader.cpp +++ b/src/libs/serialisation/Loader.cpp @@ -119,40 +119,58 @@ Loader::load(SharedPtr<EngineInterface> engine, /* Load (plugin) nodes */ RDF::Query query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?name ?plugin ?floatkey ?floatval WHERE {\n") + + "SELECT DISTINCT ?name ?plugin ?floatkey ?floatval ?poly WHERE {\n") + patch_uri + " ingen:node ?node .\n" "?node ingen:name ?name ;\n" " ingen:plugin ?plugin .\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) { - const string name = (*i)["name"].to_string(); - const string plugin = (*i)["plugin"].to_string(); + if (node_name.length() == 0) + node_name = (*i)["name"].to_string(); - const Path node_path = patch_path.base() + (string)name; + if (node_plugin.length() == 0) + node_plugin = rdf_world->qualify((*i)["plugin"].to_string()); - if (created.find(node_path) == created.end()) { - engine->create_node(node_path, plugin, false); - created.insert(node_path); - } + RDF::Node poly_node = (*i)["poly"]; + if (poly_node.is_bool() && poly_node.to_bool() == true) + node_polyphonic = true; - string floatkey = rdf_world->prefixes().qualify((*i)["floatkey"].to_string()); + const string floatkey = rdf_world->prefixes().qualify((*i)["floatkey"].to_string()); RDF::Node val_node = (*i)["floatval"]; if (floatkey != "" && val_node.is_float()) - engine->set_metadata(patch_path.base() + name, floatkey, Atom(val_node.to_float())); + metadata.insert(make_pair(floatkey, Atom(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 */ query = RDF::Query(*rdf_world, Glib::ustring( - "SELECT DISTINCT ?patch ?name WHERE {\n") + + "SELECT DISTINCT ?patch ?name WHERE {\n") + patch_uri + " ingen:node ?patch .\n" "?patch a ingen:Patch ;\n" " ingen:name ?name .\n" |