summaryrefslogtreecommitdiff
path: root/libs/ardour/plugin_insert.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-02-01 01:07:38 +0000
committerCarl Hetherington <carl@carlh.net>2011-02-01 01:07:38 +0000
commit636ffd7d8df8642ec6566632ac589fb03056b032 (patch)
tree7a56123f82b15199228ac8e64db53097581da394 /libs/ardour/plugin_insert.cc
parent408d4338423fa09b29fee6573ed0d9e4aa3dc729 (diff)
Fix up display of plugin automation when loading 2.X sessions.
git-svn-id: svn://localhost/ardour2/branches/3.0@8635 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/plugin_insert.cc')
-rw-r--r--libs/ardour/plugin_insert.cc28
1 files changed, 26 insertions, 2 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index 25f700b7ca..996d3d7dbf 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -934,9 +934,9 @@ PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
XMLNode *child;
const char *port;
uint32_t port_id;
-
+
cnodes = (*niter)->children ("port");
-
+
for (iter = cnodes.begin(); iter != cnodes.end(); ++iter){
child = *iter;
@@ -961,6 +961,30 @@ PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
if (c) {
if (!child->children().empty()) {
c->alist()->set_state (*child->children().front(), version);
+
+ /* In some cases 2.X saves lists with min_yval and max_yval
+ being FLT_MIN and FLT_MAX respectively. This causes problems
+ in A3 because these min/max values are used to compute
+ where GUI control points should be drawn. If we see such
+ values, `correct' them to the min/max of the appropriate
+ parameter.
+ */
+
+ float min_y = c->alist()->get_min_y ();
+ float max_y = c->alist()->get_max_y ();
+
+ Plugin::ParameterDescriptor desc;
+ _plugins.front()->get_parameter_descriptor (port_id, desc);
+
+ if (min_y == FLT_MIN) {
+ min_y = desc.lower;
+ }
+
+ if (max_y == FLT_MAX) {
+ max_y = desc.upper;
+ }
+
+ c->alist()->set_yrange (min_y, max_y);
}
} else {
error << string_compose (_("PluginInsert: automatable control %1 not found - ignored"), port_id) << endmsg;