13
0

Fix restore of fader automation from 2.X sessions.

git-svn-id: svn://localhost/ardour2/branches/3.0@7754 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-09-07 23:26:21 +00:00
parent 5ce3409e5d
commit 136b8ed747
7 changed files with 47 additions and 11 deletions

View File

@ -194,7 +194,8 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session* s, boost::shared_ptr<Ro
controls_ebox.set_name (controls_base_unselected_name);
XMLNode* xml_node = get_parent_with_state()->get_automation_child_xml_node (
_control->parameter());
_control->parameter(), Stateful::loading_state_version
);
if (xml_node) {
set_state (*xml_node, Stateful::loading_state_version);
@ -403,7 +404,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
TimeAxisView* state_parent = get_parent_with_state ();
assert(state_parent);
XMLNode* xml_node = state_parent->get_automation_child_xml_node (_control->parameter());
XMLNode* xml_node = state_parent->get_automation_child_xml_node (_control->parameter(), Stateful::loading_state_version);
TimeAxisView::set_height (h);
_base_rect->property_y2() = h;
@ -950,6 +951,10 @@ AutomationTimeAxisView::set_state (const XMLNode& node, int version)
{
TimeAxisView::set_state (node, version);
if (version < 3000) {
return set_state_2X (node, version);
}
XMLProperty const * type = node.property ("automation-id");
if (type && type->value () == ARDOUR::EventTypeMap::instance().to_symbol (_control->parameter())) {
XMLProperty const * shown = node.property ("shown");
@ -966,13 +971,31 @@ AutomationTimeAxisView::set_state (const XMLNode& node, int version)
return 0;
}
int
AutomationTimeAxisView::set_state_2X (const XMLNode& node, int version)
{
if (node.name() == X_("gain") && _control->parameter() == Evoral::Parameter (GainAutomation)) {
XMLProperty const * shown = node.property (X_("shown"));
if (shown && string_is_affirmative (shown->value ())) {
set_marked_for_display (true);
_canvas_display->show (); /* FIXME: necessary? show_at? */
}
}
if (!_marked_for_display) {
hide ();
}
return 0;
}
XMLNode*
AutomationTimeAxisView::get_state_node ()
{
TimeAxisView* state_parent = get_parent_with_state ();
if (state_parent) {
return state_parent->get_automation_child_xml_node (_control->parameter());
return state_parent->get_automation_child_xml_node (_control->parameter(), Stateful::loading_state_version);
} else {
return 0;
}

View File

@ -175,6 +175,9 @@ class AutomationTimeAxisView : public TimeAxisView {
static Pango::FontDescription* name_font;
static bool have_name_font;
private:
int set_state_2X (const XMLNode &, int);
};
#endif /* __ardour_gtk_automation_time_axis_h__ */

View File

@ -117,7 +117,7 @@ public:
/* make sure we get the right version of this */
XMLNode* get_automation_child_xml_node (Evoral::Parameter param) { return RouteUI::get_automation_child_xml_node (param); }
XMLNode* get_automation_child_xml_node (Evoral::Parameter param, int version) { return RouteUI::get_automation_child_xml_node (param, version); }
typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
AutomationTracks automation_tracks() { return _automation_tracks; }

View File

@ -1271,7 +1271,7 @@ RouteUI::ensure_xml_node ()
}
XMLNode*
RouteUI::get_automation_child_xml_node (Evoral::Parameter param)
RouteUI::get_automation_child_xml_node (Evoral::Parameter param, int version)
{
ensure_xml_node ();
@ -1281,10 +1281,17 @@ RouteUI::get_automation_child_xml_node (Evoral::Parameter param)
const string sym = ARDOUR::EventTypeMap::instance().to_symbol(param);
for (iter = kids.begin(); iter != kids.end(); ++iter) {
if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
XMLProperty* type = (*iter)->property("automation-id");
if (type && type->value() == sym)
if (version < 3000) {
if ((*iter)->name() == sym) {
return *iter;
}
} else {
if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
XMLProperty* type = (*iter)->property("automation-id");
if (type && type->value() == sym)
return *iter;
}
}
}

View File

@ -111,7 +111,7 @@ class RouteUI : public virtual AxisView
XMLNode *xml_node;
void ensure_xml_node ();
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter param);
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter, int);
bool mute_press(GdkEventButton*);
bool mute_release(GdkEventButton*);

View File

@ -206,7 +206,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
/* call this on the parent */
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter /*param*/) { return 0; }
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter, int) { return 0; }
virtual LayerDisplay layer_display () const { return Overlaid; }
virtual StreamView* view () const { return 0; }

View File

@ -2160,6 +2160,9 @@ Route::_set_state_2X (const XMLNode& node, int version)
if (io_child->name() == X_("Panner")) {
_main_outs->panner()->set_state(*io_child, version);
} else if (io_child->name() == X_("Automation")) {
/* IO's automation is for the fader */
_amp->set_automation_state (*io_child, Evoral::Parameter (GainAutomation));
}
}
}
@ -2189,7 +2192,7 @@ Route::_set_state_2X (const XMLNode& node, int version)
XMLNode *cmt = *(child->children().begin());
_comment = cmt->content();
} else if (child->name() == X_("Extra")) {
} else if (child->name() == X_("extra")) {
_extra_xml = new XMLNode (*child);