From 767c0238a34ef4acc4d345e88cd5ddb0c8a8e421 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 1 Dec 2014 14:28:03 -0500 Subject: Replace half-baked param metadata with descriptor. Among other things, this means that automation controls/lists have the actual min/max/normal/toggled of parameters, and not those inferred from the Parameter ID, which is not correct for things like plugin parameters. Pushing things down to the Evoral::ParmeterDescriptor may be useful in the future to have lists do smarter things based on parameter range, but currently I have just pushed down the above-mentioned currently used attributes. --- libs/ardour/automatable.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'libs/ardour/automatable.cc') diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 906ff4ed3e..0538c84cc5 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -212,7 +212,7 @@ Automatable::set_automation_xml_state (const XMLNode& node, Evoral::Parameter le const XMLProperty* id_prop = (*niter)->property("automation-id"); Evoral::Parameter param = (id_prop - ? EventTypeMap::instance().new_parameter(id_prop->value()) + ? EventTypeMap::instance().from_symbol(id_prop->value()) : legacy_param); if (param.type() == NullAutomation) { @@ -399,14 +399,15 @@ Automatable::transport_stopped (framepos_t now) boost::shared_ptr Automatable::control_factory(const Evoral::Parameter& param) { - boost::shared_ptr list(new AutomationList(param)); - Evoral::Control* control = NULL; - ParameterDescriptor desc(param); + Evoral::Control* control = NULL; + bool make_list = true; + ParameterDescriptor desc(param); + boost::shared_ptr list; if (param.type() >= MidiCCAutomation && param.type() <= MidiChannelPressureAutomation) { MidiTrack* mt = dynamic_cast(this); if (mt) { control = new MidiTrack::MidiControl(mt, param); - list.reset(); // No list, this is region "automation" + make_list = false; // No list, this is region "automation" } else { warning << "MidiCCAutomation for non-MidiTrack" << endl; } @@ -424,7 +425,9 @@ Automatable::control_factory(const Evoral::Parameter& param) desc = pi->plugin(0)->get_property_descriptor(param.id()); if (desc.datatype != Variant::NOTHING) { if (!Variant::type_is_numeric(desc.datatype)) { - list.reset(); // Can't automate non-numeric data yet + make_list = false; // Can't automate non-numeric data yet + } else { + list = boost::shared_ptr(new AutomationList(param, desc)); } control = new PluginInsert::PluginPropertyControl(pi, param, desc, list); } @@ -447,11 +450,14 @@ Automatable::control_factory(const Evoral::Parameter& param) } } + if (make_list && !list) { + list = boost::shared_ptr(new AutomationList(param, desc)); + } + if (!control) { - control = new AutomationControl(_a_session, param, desc); + control = new AutomationControl(_a_session, param, desc, list); } - control->set_list(list); return boost::shared_ptr(control); } -- cgit v1.2.3