summaryrefslogtreecommitdiff
path: root/libs/ardour/automatable.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-01 14:28:03 -0500
committerDavid Robillard <d@drobilla.net>2014-12-01 23:35:24 -0500
commit767c0238a34ef4acc4d345e88cd5ddb0c8a8e421 (patch)
treefed11fb6f4e4e08a7c35eb45f53aea70dc66e4f8 /libs/ardour/automatable.cc
parentcb8abbe8d2f0e4dfe52bd35613ebba7689628eca (diff)
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.
Diffstat (limited to 'libs/ardour/automatable.cc')
-rw-r--r--libs/ardour/automatable.cc22
1 files changed, 14 insertions, 8 deletions
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<Evoral::Control>
Automatable::control_factory(const Evoral::Parameter& param)
{
- boost::shared_ptr<AutomationList> 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<AutomationList> list;
if (param.type() >= MidiCCAutomation && param.type() <= MidiChannelPressureAutomation) {
MidiTrack* mt = dynamic_cast<MidiTrack*>(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<AutomationList>(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<AutomationList>(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<Evoral::Control>(control);
}