2 * Copyright (C) 2008-2014 David Robillard <d@drobilla.net>
3 * Copyright (C) 2010-2012 Carl Hetherington <carl@carlh.net>
4 * Copyright (C) 2010-2013 Paul Davis <paul@linuxaudiosystems.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef EVORAL_CONTROL_HPP
22 #define EVORAL_CONTROL_HPP
26 #include <boost/shared_ptr.hpp>
27 #include "pbd/signals.h"
29 #include "evoral/visibility.h"
30 #include "evoral/Parameter.hpp"
31 #include "evoral/ParameterDescriptor.hpp"
36 class ParameterDescriptor;
40 /** Base class representing some kind of (automatable) control; a fader's gain,
41 * for example, or a compressor plugin's threshold.
43 * The class knows the Evoral::Parameter that it is controlling, and has
44 * a list of values for automation.
46 class LIBEVORAL_API Control
49 Control(const Parameter& parameter,
50 const ParameterDescriptor& desc,
51 boost::shared_ptr<ControlList> list);
55 virtual void set_double (double val, double frame=0, bool to_list=false);
56 virtual double get_double (bool from_list=false, double frame=0) const;
58 /** Get the latest user-set value
59 * (which may not equal get_value() when automation is playing back).
61 * Automation write/touch works by periodically sampling this value
62 * and adding it to the ControlList.
64 double user_double() const { return _user_value; }
66 void set_list(boost::shared_ptr<ControlList>);
68 boost::shared_ptr<ControlList> list() { return _list; }
69 boost::shared_ptr<const ControlList> list() const { return _list; }
71 inline const Parameter& parameter() const { return _parameter; }
73 /** Emitted when the our ControlList is marked dirty */
74 PBD::Signal0<void> ListMarkedDirty;
78 boost::shared_ptr<ControlList> _list;
80 PBD::ScopedConnection _list_marked_dirty_connection;
83 void list_marked_dirty ();
88 #endif // EVORAL_CONTROL_HPP