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 <ardour/session_object.h>
26 #include <ardour/automation_event.h>
27 #include <ardour/param_id.h>
33 class Automatable : public SessionObject
36 Automatable(Session&, const std::string& name);
38 virtual ~Automatable() {}
40 // shorthand for gain, pan, etc
41 inline AutomationList* automation_list(AutomationType type, bool create_if_missing=false) {
42 return automation_list(ParamID(type), create_if_missing);
45 virtual AutomationList* automation_list(ParamID id, bool create_if_missing=false);
46 virtual const AutomationList* automation_list(ParamID id) const;
48 virtual void add_automation_parameter(AutomationList* al);
50 virtual void automation_snapshot(nframes_t now) {};
52 virtual bool find_next_event(nframes_t start, nframes_t end, ControlEvent& ev) const;
54 virtual string describe_parameter(ParamID param);
55 virtual float default_parameter_value(ParamID param) { return 1.0f; }
57 virtual void clear_automation();
59 AutoState get_parameter_automation_state (ParamID param);
60 virtual void set_parameter_automation_state (ParamID param, AutoState);
62 AutoStyle get_parameter_automation_style (ParamID param);
63 void set_parameter_automation_style (ParamID param, AutoStyle);
65 void protect_automation ();
67 void what_has_automation(std::set<ParamID>&) const;
68 void what_has_visible_automation(std::set<ParamID>&) const;
69 const std::set<ParamID>& what_can_be_automated() const { return _can_automate_list; }
71 void mark_automation_visible(ParamID, bool);
75 void can_automate(ParamID);
77 virtual void automation_list_creation_callback(ParamID, AutomationList&) {}
79 int set_automation_state(const XMLNode&, ParamID default_param);
80 XMLNode& get_automation_state();
82 int load_automation (const std::string& path);
83 int old_set_automation_state(const XMLNode&);
85 mutable Glib::Mutex _automation_lock;
87 std::map<ParamID,AutomationList*> _parameter_automation;
88 std::set<ParamID> _visible_parameter_automation;
89 std::set<ParamID> _can_automate_list;
91 nframes_t _last_automation_snapshot;
96 #endif /* __ardour_automatable_h__ */