Fixes to bundle manager to make it vaguely usable.
[ardour.git] / gtk2_ardour / automation_controller.cc
index dc9b8bb2c40e494bac82209367e0cbf9a0a86bf6..6f62608f0a8c789f067a3bc1ae897841c1bd15f1 100644 (file)
 */
 
 #include <pbd/error.h>
-#include "ardour/automation_event.h"
+#include "ardour/automation_list.h"
 #include "ardour/automation_control.h"
+#include "ardour/event_type_map.h"
+#include "ardour/automatable.h"
 #include "ardour_ui.h"
 #include "utils.h"
 #include "automation_controller.h"
@@ -63,13 +65,15 @@ AutomationController::~AutomationController()
 boost::shared_ptr<AutomationController>
 AutomationController::create(
                boost::shared_ptr<Automatable> parent,
-               boost::shared_ptr<Evoral::ControlList> cl,
+               const Evoral::Parameter& param,
                boost::shared_ptr<AutomationControl> ac)
 {
-       Gtk::Adjustment* adjustment = manage(new Gtk::Adjustment(cl->default_value(), cl->get_min_y(), cl->get_max_y()));
+       Gtk::Adjustment* adjustment = manage(new Gtk::Adjustment(param.normal(), param.min(), param.max()));
        if (!ac) {
-               PBD::warning << "Creating AutomationController for " << cl->parameter().symbol() << endmsg;
-               ac = boost::dynamic_pointer_cast<AutomationControl>(parent->control_factory(cl));
+               PBD::warning << "Creating AutomationController for " << EventTypeMap::instance().to_symbol(param) << endmsg;
+               ac = boost::dynamic_pointer_cast<AutomationControl>(parent->control_factory(param));
+       } else {
+               assert(ac->parameter() == param);
        }
        return boost::shared_ptr<AutomationController>(new AutomationController(ac, adjustment));
 }