*/
#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"
}
boost::shared_ptr<AutomationController>
-AutomationController::create(boost::shared_ptr<Automatable> parent, boost::shared_ptr<AutomationList> al, boost::shared_ptr<AutomationControl> ac)
+AutomationController::create(
+ boost::shared_ptr<Automatable> parent,
+ const Evoral::Parameter& param,
+ boost::shared_ptr<AutomationControl> ac)
{
- Gtk::Adjustment* adjustment = manage(new Gtk::Adjustment(al->default_value(), al->get_min_y(), al->get_max_y()));
+ Gtk::Adjustment* adjustment = manage(new Gtk::Adjustment(param.normal(), param.min(), param.max()));
if (!ac) {
- PBD::warning << "Creating AutomationController for " << al->parameter().to_string() << endmsg;
- ac = parent->control_factory(al);
+ 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));
}
void
AutomationController::start_touch()
{
- _controllable->list()->start_touch();
+ _controllable->start_touch();
}
void
AutomationController::end_touch()
{
- _controllable->list()->stop_touch();
+ _controllable->stop_touch();
}
void
{
ENSURE_GUI_THREAD(mem_fun(*this, &AutomationController::automation_state_changed));
- bool x = (_controllable->list()->automation_state() != Off);
+ bool x = (_controllable->automation_state() != Off);
/* start watching automation so that things move */