2 Copyright (C) 2000-2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_automatable_h__
21 #define __ardour_automatable_h__
25 #include <boost/shared_ptr.hpp>
26 #include <ardour/session_object.h>
27 #include <ardour/automation_event.h>
28 #include <ardour/automation_control.h>
29 #include <ardour/parameter.h>
30 #include <evoral/ControlSet.hpp>
35 class AutomationControl;
37 class Automatable : public SessionObject, virtual public Evoral::ControlSet
40 Automatable(Session&, const std::string& name);
42 virtual ~Automatable() {}
44 boost::shared_ptr<Evoral::Control> control_factory(boost::shared_ptr<Evoral::ControlList> list) const;
45 boost::shared_ptr<Evoral::ControlList> control_list_factory(const Evoral::Parameter& param) const;
47 virtual void add_control(boost::shared_ptr<Evoral::Control>);
49 virtual void automation_snapshot(nframes_t now, bool force);
50 bool should_snapshot (nframes_t now) {
51 return (_last_automation_snapshot > now || (now - _last_automation_snapshot) > _automation_interval);
53 virtual void transport_stopped(nframes_t now);
55 virtual string describe_parameter(Parameter param);
57 AutoState get_parameter_automation_state (Parameter param, bool lock = true);
58 virtual void set_parameter_automation_state (Parameter param, AutoState);
60 AutoStyle get_parameter_automation_style (Parameter param);
61 void set_parameter_automation_style (Parameter param, AutoStyle);
63 void protect_automation ();
65 void what_has_visible_data(std::set<Parameter>&) const;
66 const std::set<Parameter>& what_can_be_automated() const { return _can_automate_list; }
68 void mark_automation_visible(Parameter, bool);
70 static void set_automation_interval (jack_nframes_t frames) {
71 _automation_interval = frames;
74 static jack_nframes_t automation_interval() {
75 return _automation_interval;
80 void can_automate(Parameter);
82 virtual void auto_state_changed (Parameter which) {}
84 int set_automation_state(const XMLNode&, Parameter default_param);
85 XMLNode& get_automation_state();
87 int load_automation (const std::string& path);
88 int old_set_automation_state(const XMLNode&);
90 std::set<Parameter> _visible_controls;
91 std::set<Parameter> _can_automate_list;
93 nframes_t _last_automation_snapshot;
94 static nframes_t _automation_interval;
99 #endif /* __ardour_automatable_h__ */