2 Copyright (C) 2007 Paul Davis
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __ardour_automation_control_h__
22 #define __ardour_automation_control_h__
24 #include <boost/shared_ptr.hpp>
25 #include <pbd/controllable.h>
26 #include <ardour/parameter.h>
27 #include <evoral/Control.hpp>
28 #include <ardour/automation_list.h>
37 /** A PBD::Controllable with associated automation data (AutomationList)
39 class AutomationControl : public PBD::Controllable, public Evoral::Control
42 AutomationControl(ARDOUR::Session&,
43 const Parameter& parameter,
44 boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(),
45 const string& name="");
47 boost::shared_ptr<AutomationList> alist() const { return boost::dynamic_pointer_cast<AutomationList>(_list); }
49 void set_list(boost::shared_ptr<Evoral::ControlList>);
51 inline bool automation_playback() const {
52 return ((ARDOUR::AutomationList*)_list.get())->automation_playback();
55 inline bool automation_write() const {
56 return ((ARDOUR::AutomationList*)_list.get())->automation_write();
59 inline AutoState automation_state() const {
60 return ((ARDOUR::AutomationList*)_list.get())->automation_state();
63 inline void start_touch() {
64 return ((ARDOUR::AutomationList*)_list.get())->start_touch();
67 inline void stop_touch() {
68 return ((ARDOUR::AutomationList*)_list.get())->stop_touch();
71 /** Set the value and do the right thing based on automation state
72 * (e.g. record if necessary, etc.)
74 void set_value(float val);
76 /** Get the current effective value based on automation state.
78 float get_value() const;
81 ARDOUR::Session& _session;
87 #endif /* __ardour_automation_control_h__ */