From 599b4833362ca131ed4c4cd186a38de0764b1ec9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 12 Sep 2007 03:20:59 +0000 Subject: Fix manually specifying polyphony in load patch dialog. git-svn-id: http://svn.drobilla.net/lad/ingen@703 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/DeprecatedLoader.cpp | 18 +++++++++++------- src/libs/client/DeprecatedLoader.hpp | 1 - 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index 19ce6b7e..621420c4 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -39,8 +39,7 @@ #include "PluginModel.hpp" #include "DeprecatedLoader.hpp" -using std::string; using std::vector; using std::pair; -using std::cerr; using std::cout; using std::endl; +using namespace std; namespace Ingen { namespace Client { @@ -188,7 +187,6 @@ string DeprecatedLoader::load_patch(const Glib::ustring& filename, boost::optional parent_path, string name, - uint32_t poly, MetadataMap initial_data, bool existing) { @@ -197,7 +195,13 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, Path path = "/"; // path of the new patch const bool load_name = (name == ""); - const bool load_poly = (poly == 0); + + size_t poly = 0; + + /* Use parameter overridden polyphony, if given */ + Raul::Table::iterator poly_param = initial_data.find("ingen:polyphony"); + if (poly_param != initial_data.end() && poly_param->second.type() == Atom::INT) + poly = poly_param->second; if (initial_data.find("filename") == initial_data.end()) initial_data["filename"] = Atom(filename.c_str()); // FIXME: URL? @@ -239,7 +243,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, path = Path("/"); } } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) { - if (load_poly) { + if (poly == 0) { poly = atoi((char*)key); } } else if (xmlStrcmp(cur->name, (const xmlChar*)"connection") @@ -569,7 +573,7 @@ DeprecatedLoader::load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNode if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) { name = (const char*)key; } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) { - poly = atoi((const char*)key); + initial_data.insert(make_pair("ingen::polyphony", (int)poly)); } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"filename"))) { filename = (const char*)key; } else { // Don't know what this tag is, add it as metadata @@ -584,7 +588,7 @@ DeprecatedLoader::load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNode // load_patch sets the passed metadata last, so values stored in the parent // will override values stored in the child patch file - string path = load_patch(filename, parent, name, poly, initial_data, false); + /*string path = */load_patch(filename, parent, name, initial_data, false); return false; } diff --git a/src/libs/client/DeprecatedLoader.hpp b/src/libs/client/DeprecatedLoader.hpp index fd1be335..413c46b5 100644 --- a/src/libs/client/DeprecatedLoader.hpp +++ b/src/libs/client/DeprecatedLoader.hpp @@ -63,7 +63,6 @@ public: string load_patch(const Glib::ustring& filename, boost::optional parent_path, string name, - uint32_t poly, MetadataMap initial_data, bool existing = false); -- cgit v1.2.1