2 * Copyright (C) 2008-2016 David Robillard <d@drobilla.net>
3 * Copyright (C) 2010-2014 Paul Davis <paul@linuxaudiosystems.com>
4 * Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
5 * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "evoral/Control.h"
25 #include "evoral/ControlList.h"
26 #include "evoral/ParameterDescriptor.h"
27 #include "evoral/TypeMap.h"
31 Control::Control(const Parameter& parameter,
32 const ParameterDescriptor& desc,
33 boost::shared_ptr<ControlList> list)
34 : _parameter(parameter)
35 , _user_value(desc.normal)
41 /** Get the currently effective value (ie the one that corresponds to current output)
44 Control::get_double (bool from_list, double frame) const
47 return _list->eval(frame);
55 Control::set_double (double value, double frame, bool to_list)
59 /* if we're in a write pass, the automation watcher will determine the
60 values and add them to the list, so we we don't need to bother.
63 if (to_list && (!_list->in_write_pass() || _list->descriptor().toggled)) {
64 _list->add (frame, value, false);
70 Control::set_list(boost::shared_ptr<ControlList> list)
72 _list_marked_dirty_connection.disconnect ();
77 _list->Dirty.connect_same_thread (_list_marked_dirty_connection, boost::bind (&Control::list_marked_dirty, this));
82 Control::list_marked_dirty ()
84 ListMarkedDirty (); /* EMIT SIGNAL */