summaryrefslogtreecommitdiffstats
path: root/src/libs/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-12 03:20:59 +0000
committerDavid Robillard <d@drobilla.net>2007-09-12 03:20:59 +0000
commit599b4833362ca131ed4c4cd186a38de0764b1ec9 (patch)
treeac6d0fc1f3c4faa395e2d0fb7bc899128793e77a /src/libs/client
parentc13e988094bca2c19b0676f8cfd60f3cff2f4a57 (diff)
downloadingen-599b4833362ca131ed4c4cd186a38de0764b1ec9.tar.gz
ingen-599b4833362ca131ed4c4cd186a38de0764b1ec9.tar.bz2
ingen-599b4833362ca131ed4c4cd186a38de0764b1ec9.zip
Fix manually specifying polyphony in load patch dialog.
git-svn-id: http://svn.drobilla.net/lad/ingen@703 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r--src/libs/client/DeprecatedLoader.cpp18
-rw-r--r--src/libs/client/DeprecatedLoader.hpp1
2 files changed, 11 insertions, 8 deletions
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<Path> 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<string, Atom>::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<Path> parent_path,
string name,
- uint32_t poly,
MetadataMap initial_data,
bool existing = false);