X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fautomation_control.cc;h=1460c42c7bd75420089b5f37c21657a5cf810e97;hb=932d6c79d01be93f491415ef1491bca17d92671f;hp=a16306838a6d5f165c9c7db62bd3fd2f5bbe6e4c;hpb=d357eca668044badcb4bab318e2e74cfffa9a0b0;p=ardour.git diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index a16306838a..1460c42c7b 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -19,41 +19,43 @@ */ #include -#include -#include -#include -#include +#include "ardour/automatable.h" +#include "ardour/automation_control.h" +#include "ardour/event_type_map.h" +#include "ardour/session.h" using namespace std; using namespace ARDOUR; using namespace PBD; -AutomationControl::AutomationControl(Session& session, boost::shared_ptr list, string name) - : Controllable((name == "unnamed controllable") ? list->parameter().symbol() : name) - , Evoral::Control(list) +AutomationControl::AutomationControl( + ARDOUR::Session& session, + const Evoral::Parameter& parameter, + boost::shared_ptr list, + const string& name) + : Controllable((name != "") ? name : EventTypeMap::instance().to_symbol(parameter)) + , Evoral::Control(parameter, list) , _session(session) { } -/** Get the currently effective value (ie the one that corresponds to current output) - */ float AutomationControl::get_value() const { - bool from_list = ((AutomationList*)_list.get())->automation_playback(); - return Control::get_value(from_list, _session.transport_frame()); + bool from_list = _list && ((AutomationList*)_list.get())->automation_playback(); + return Control::get_float(from_list, _session.transport_frame()); } void AutomationControl::set_value(float value) { - bool to_list = _session.transport_stopped() - && ((AutomationList*)_list.get())->automation_playback(); - - Control::set_value(value, to_list, _session.transport_frame()); + bool to_list = _list && _session.transport_stopped() + && ((AutomationList*)_list.get())->automation_write(); + + Control::set_float(value, to_list, _session.transport_frame()); Changed(); /* EMIT SIGNAL */ }