fix load+save of plugin parameter automation
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 24 Aug 2010 22:07:53 +0000 (22:07 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 24 Aug 2010 22:07:53 +0000 (22:07 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7678 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/audio_time_axis.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/selection.cc
libs/ardour/automatable.cc
libs/ardour/automation_list.cc
libs/ardour/plugin_insert.cc
libs/ardour/processor.cc

index fd809a9b0d7cafd692e299e9c43fa4b7b0bf4844..a763da39c5891803b365c56b60b8c9816d9c35a7 100644 (file)
@@ -210,6 +210,10 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
                ensure_xml_node ();
                ensure_pan_views (show);
 
+        } else if (param.type() == PluginAutomation) {
+                
+                /* handled elsewhere */
+
        } else {
                error << "AudioTimeAxisView: unknown automation child " << EventTypeMap::instance().to_symbol(param) << endmsg;
        }
index c62ea68b2a211f49e90af9c0f4c8660a95fefe3d..2c64615ea18f48b1d32391aae9f2db5320563d5d 100644 (file)
@@ -1827,9 +1827,10 @@ RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor>
        ProcessorAutomationNode* pan;
 
        if ((pan = find_processor_automation_node (processor, what)) == 0) {
-               error << _("programming error: ")
-                     << string_compose (X_("processor automation curve for %1:%2 not registered with track!"),
-                                 processor->name(), what)
+                /* session state may never have been saved with new plugin */
+                error << _("programming error: ")
+                     << string_compose (X_("processor automation curve for %1:%2/%3/%4 not registered with track!"),
+                                         processor->name(), what.type(), (int) what.channel(), what.id() )
                      << endmsg;
                /*NOTREACHED*/
                return;
@@ -1846,7 +1847,7 @@ RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor>
        /* FIXME: ew */
 
        char state_name[256];
-       snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id());
+       snprintf (state_name, sizeof (state_name), "%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id());
 
        boost::shared_ptr<AutomationControl> control
                        = boost::dynamic_pointer_cast<AutomationControl>(processor->control(what, true));
index 5b1bba1f3c76c4347a10cdebcd9a0c7ef80bace1..3e9cd416989d32050e5376b49609c78ccdca409f 100644 (file)
@@ -1140,9 +1140,15 @@ Selection::set_state (XMLNode const & node, int)
                        assert (rtv);
                        
                        boost::shared_ptr<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().new_parameter (prop_parameter->value ()));
-                       assert (atv);
-                       
-                       add (atv.get());
+                        
+                        /* the automation could be for an entity that was never saved
+                           in the session file. Don't freak out if we can't find
+                           it.
+                        */
+
+                        if (atv) {
+                                add (atv.get());
+                        }
                }
        }
 
index 68c42ba7b57d21ffa636768bf65f809637c01b87..0c28eb95e01332655ec255c47c0c34a02a69b40f 100644 (file)
@@ -253,7 +253,7 @@ Automatable::set_automation_state (const XMLNode& node, Evoral::Parameter legacy
                        if (param.type() == NullAutomation) {
                                warning << "Automation has null type" << endl;
                                continue;
-                       }
+                        }
 
                        boost::shared_ptr<AutomationList> al (new AutomationList(**niter, param));
 
index 53fdb233c6b35f17887aece10c7860bee5e4fcf0..c8f5d18aec7377c4c01362842e6486d2359eac47 100644 (file)
@@ -41,13 +41,12 @@ PBD::Signal1<void,AutomationList *> AutomationList::AutomationListCreated;
 static void dumpit (const AutomationList& al, string prefix = "")
 {
        cerr << prefix << &al << endl;
-       for (AutomationList::const_iterator i = al.const_begin(); i != al.const_end(); ++i) {
+       for (AutomationList::const_iterator i = al.begin(); i != al.end(); ++i) {
                cerr << prefix << '\t' << (*i)->when << ',' << (*i)->value << endl;
        }
        cerr << "\n";
 }
 #endif
-
 AutomationList::AutomationList (Evoral::Parameter id)
        : ControlList(id)
 {
@@ -364,7 +363,7 @@ AutomationList::deserialize_events (const XMLNode& node)
        }
 
         thaw ();
-        
+
        return 0;
 }
 
@@ -465,19 +464,19 @@ AutomationList::set_state (const XMLNode& node, int version)
                _state = Off;
        }
 
-       if ((prop = node.property (X_("min_yval"))) != 0) {
+       if ((prop = node.property (X_("min-yval"))) != 0) {
                _min_yval = atof (prop->value ().c_str());
        } else {
                _min_yval = FLT_MIN;
        }
 
-       if ((prop = node.property (X_("max_yval"))) != 0) {
+       if ((prop = node.property (X_("max-yval"))) != 0) {
                _max_yval = atof (prop->value ().c_str());
        } else {
                _max_yval = FLT_MAX;
        }
 
-       if ((prop = node.property (X_("max_xval"))) != 0) {
+       if ((prop = node.property (X_("max-xval"))) != 0) {
                _max_xval = atof (prop->value ().c_str());
        } else {
                _max_xval = 0; // means "no limit ;
index a0deec6807e5f7541d70375949c2c569352f3984..108a7e03aa25b37866d0b159c29e894bfc0ae8d4 100644 (file)
@@ -684,25 +684,6 @@ PluginInsert::state (bool full)
        node.add_property("count", string_compose("%1", _plugins.size()));
        node.add_child_nocopy (_plugins[0]->get_state());
 
-       /* add port automation state */
-       XMLNode *autonode = new XMLNode(port_automation_node_name);
-       set<Evoral::Parameter> automatable = _plugins[0]->automatable();
-
-       for (set<Evoral::Parameter>::iterator x = automatable.begin(); x != automatable.end(); ++x) {
-               
-               /*XMLNode* child = new XMLNode("port");
-               snprintf(buf, sizeof(buf), "%" PRIu32, *x);
-               child->add_property("number", string(buf));
-               
-               child->add_child_nocopy (automation_list (*x).state (full));
-               autonode->add_child_nocopy (*child);
-               */
-               AutomationList* list = dynamic_cast<AutomationList*>(control(*x)->list().get());
-               autonode->add_child_nocopy (list->state (full));
-       }
-
-       node.add_child_nocopy (*autonode);
-
        return node;
 }
 
@@ -816,11 +797,11 @@ PluginInsert::set_state(const XMLNode& node, int version)
                        }
                }
                
-               set_parameter_state_2X (node, version);
+               // set_parameter_state_2X (node, version);
                
        } else {
 
-               set_parameter_state (node, version);
+               // set_parameter_state (node, version);
        }
 
        // The name of the PluginInsert comes from the plugin, nothing else
index 0bea376fc93630888307dfa6faf6b5ea9226fdb9..555dff5092e2a4ec015e47b7105939336bbcc4a5 100644 (file)
@@ -115,10 +115,11 @@ Processor::state (bool full_state)
                        stringstream sstr;
                        for (set<Evoral::Parameter>::iterator x = _visible_controls.begin();
                                        x != _visible_controls.end(); ++x) {
+                                
                                if (x != _visible_controls.begin()) {
                                        sstr << ' ';
                                }
-                               sstr << *x;
+                               sstr << (*x).id();
                        }
 
                        automation.add_property ("visible", sstr.str());