diff options
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/client/NodeModel.cpp | 12 | ||||
-rw-r--r-- | src/libs/client/NodeModel.hpp | 2 | ||||
-rw-r--r-- | src/libs/engine/MidiNoteNode.cpp | 10 | ||||
-rw-r--r-- | src/libs/serialisation/Loader.cpp | 46 |
4 files changed, 31 insertions, 39 deletions
diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp index 55f1217b..c7b38ceb 100644 --- a/src/libs/client/NodeModel.cpp +++ b/src/libs/client/NodeModel.cpp @@ -26,17 +26,15 @@ namespace Client { NodeModel::NodeModel(SharedPtr<PluginModel> plugin, const Path& path, bool polyphonic) - - : ObjectModel(path, polyphonic), - _polyphonic(polyphonic), - _plugin_uri(plugin->uri()), - _plugin(plugin) + : ObjectModel(path, polyphonic) + , _plugin_uri(plugin->uri()) + , _plugin(plugin) { } NodeModel::NodeModel(const string& plugin_uri, const Path& path, bool polyphonic) -: ObjectModel(path, polyphonic), - _plugin_uri(plugin_uri) + : ObjectModel(path, polyphonic) + , _plugin_uri(plugin_uri) { } diff --git a/src/libs/client/NodeModel.hpp b/src/libs/client/NodeModel.hpp index 3c110099..fb88e2f0 100644 --- a/src/libs/client/NodeModel.hpp +++ b/src/libs/client/NodeModel.hpp @@ -56,7 +56,6 @@ public: SharedPtr<PluginModel> plugin() const { return _plugin; } int num_ports() const { return _ports.size(); } const PortModelList& ports() const { return _ports; } - virtual bool polyphonic() const { return _polyphonic; } void port_value_range(SharedPtr<PortModel> port, float& min, float& max); @@ -81,7 +80,6 @@ protected: virtual void clear(); - bool _polyphonic; PortModelList _ports; ///< List of ports (not a Table to preserve order) string _plugin_uri; ///< Plugin URI (if PluginModel is unknown) SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index 03dc01b3..fac654f0 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -94,9 +94,13 @@ MidiNoteNode::apply_poly(Raul::Maid& maid, uint32_t poly) { NodeBase::apply_poly(maid, poly); - maid.push(_voices); - _voices = _prepared_voices; - _prepared_voices = NULL; + if (_prepared_voices) { + assert(poly <= _prepared_poly); + maid.push(_voices); + _voices = _prepared_voices; + _prepared_voices = NULL; + } + _polyphony = poly; return true; 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 */ |