diff options
author | David Robillard <d@drobilla.net> | 2007-08-10 21:44:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-08-10 21:44:30 +0000 |
commit | 153fe99497a7ccc91aac6082b29748a66792d374 (patch) | |
tree | 7b0026fb763a5ccf6c3dd435f9d628b4d6cda12f /src/libs/client | |
parent | c2ea92fd6a6a24520d7f8047cc9c0d8905bc3351 (diff) | |
download | ingen-153fe99497a7ccc91aac6082b29748a66792d374.tar.gz ingen-153fe99497a7ccc91aac6082b29748a66792d374.tar.bz2 ingen-153fe99497a7ccc91aac6082b29748a66792d374.zip |
Fix loading control values from deprecated Om patches.
Eliminate parallel processing overhead if running single threaded.
git-svn-id: http://svn.drobilla.net/lad/ingen@693 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r-- | src/libs/client/DeprecatedLoader.cpp | 40 | ||||
-rw-r--r-- | src/libs/client/DeprecatedLoader.hpp | 3 | ||||
-rw-r--r-- | src/libs/client/Store.cpp | 2 |
3 files changed, 27 insertions, 18 deletions
diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index e33a6b5c..19ce6b7e 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -104,7 +104,10 @@ DeprecatedLoader::nameify_if_invalid(const string& name) return name; } else { const string new_name = Path::nameify(name); - cerr << "WARNING: Illegal name '" << name << "' converted to '" << name << "'" << endl; + assert(Path::is_valid_name(new_name)); + if (new_name != name) + cerr << "WARNING: Illegal name '" << name << "' converted to '" + << new_name << "'" << endl; return new_name; } } @@ -293,20 +296,24 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, cur = cur->next; } - // Load presets (control values) - cerr << "FIXME: load preset\n"; - /*cur = xmlDocGetRootElement(doc)->xmlChildrenNode; + cur = xmlDocGetRootElement(doc)->xmlChildrenNode; while (cur != NULL) { + // I don't think Om ever wrote any preset other than "default"... if ((!xmlStrcmp(cur->name, (const xmlChar*)"preset"))) { - load_preset(pm, doc, cur); - assert(preset_model != NULL); - if (preset_model->name() == "default") - _engine->set_preset(pm->path(), preset_model); + SharedPtr<PresetModel> pm = load_preset(path, doc, cur); + assert(pm != NULL); + if (pm->name() == "default") { + list<ControlModel>::const_iterator i = pm->controls().begin(); + for ( ; i != pm->controls().end(); ++i) { + _engine->set_port_value(i->port_path(), i->value()); + } + } else { + cerr << "WARNING: Unknown preset: \"" << pm->name() << endl; + } } cur = cur->next; } - */ xmlFreeDoc(doc); xmlCleanupParser(); @@ -634,15 +641,15 @@ DeprecatedLoader::load_connection(const Path& parent, xmlDocPtr doc, const xmlNo /** Build a PresetModel given a pointer to a preset in a patch file. */ -bool +SharedPtr<PresetModel> DeprecatedLoader::load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePtr node) { - cerr << "FIXME: load preset\n"; -#if 0 + cerr << "LOAD PRESET" << endl; + xmlNodePtr cur = node->xmlChildrenNode; xmlChar* key; - PresetModel* pm = new PresetModel(patch->path().base()); + SharedPtr<PresetModel> pm(new PresetModel(parent.base())); while (cur != NULL) { key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); @@ -674,7 +681,8 @@ DeprecatedLoader::load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePt } // Compatibility fixes for old patch files - node_name = nameify_if_invalid(node_name); + if (node_name != "") + node_name = nameify_if_invalid(node_name); port_name = nameify_if_invalid(port_name); if (port_name == "") { @@ -688,6 +696,8 @@ DeprecatedLoader::load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePt string::size_type slash_index; while ((slash_index = port_name.find("/")) != string::npos) port_name[slash_index] = '-'; + + cerr << "ADDING CONTROL: " << node_name << " / " << port_name << " = " << val << endl; pm->add_control(node_name, port_name, val); } } @@ -702,8 +712,6 @@ DeprecatedLoader::load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePt } return pm; -#endif - return false; } } // namespace Client diff --git a/src/libs/client/DeprecatedLoader.hpp b/src/libs/client/DeprecatedLoader.hpp index e3397de6..fd1be335 100644 --- a/src/libs/client/DeprecatedLoader.hpp +++ b/src/libs/client/DeprecatedLoader.hpp @@ -81,8 +81,9 @@ private: bool load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); bool load_connection(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); - bool load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); bool load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); + + SharedPtr<PresetModel> load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); }; diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 360b1053..f5cead13 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -260,7 +260,7 @@ Store::add_object(SharedPtr<ObjectModel> object) } - cout << "[Store] Added " << object->path() << endl; + //cout << "[Store] Added " << object->path() << endl; } |