+
+ if (l->automation_playback ()) {
+ c->set_value_unchecked (c->list ()->eval (now));
+ }
+ }
+}
+
+boost::shared_ptr<Evoral::Control>
+Automatable::control_factory(const Evoral::Parameter& 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);
+ make_list = false; // No list, this is region "automation"
+ }
+ } else if (param.type() == PluginAutomation) {
+ PluginInsert* pi = dynamic_cast<PluginInsert*>(this);
+ if (pi) {
+ pi->plugin(0)->get_parameter_descriptor(param.id(), desc);
+ control = new PluginInsert::PluginControl(pi, param, desc);
+ } else {
+ warning << "PluginAutomation for non-Plugin" << endl;
+ }
+ } else if (param.type() == PluginPropertyAutomation) {
+ PluginInsert* pi = dynamic_cast<PluginInsert*>(this);
+ if (pi) {
+ desc = pi->plugin(0)->get_property_descriptor(param.id());
+ if (desc.datatype != Variant::NOTHING) {
+ if (!Variant::type_is_numeric(desc.datatype)) {
+ 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);
+ }
+ } else {
+ warning << "PluginPropertyAutomation for non-Plugin" << endl;
+ }
+ } else if (param.type() == GainAutomation) {
+ control = new GainControl(_a_session, param);
+ } else if (param.type() == TrimAutomation) {
+ control = new GainControl(_a_session, param);
+ } else if (param.type() == PanAzimuthAutomation || param.type() == PanWidthAutomation || param.type() == PanElevationAutomation) {
+ Pannable* pannable = dynamic_cast<Pannable*>(this);
+ if (pannable) {
+ control = new PanControllable (_a_session, pannable->describe_parameter (param), pannable, param);
+ } else {
+ warning << "PanAutomation for non-Pannable" << endl;
+ }
+ }
+
+ if (make_list && !list) {
+ list = boost::shared_ptr<AutomationList>(new AutomationList(param, desc));
+ }
+
+ if (!control) {
+ control = new AutomationControl(_a_session, param, desc, list);