2019-08-03 05:10:55 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2008-2016 David Robillard <d@drobilla.net>
|
|
|
|
|
* Copyright (C) 2010-2014 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
|
* Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
|
|
|
|
|
* Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
|
2009-10-14 16:10:01 +00:00
|
|
|
*
|
2019-08-03 05:10:55 +02:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
2009-10-14 16:10:01 +00:00
|
|
|
*
|
2019-08-03 05:10:55 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
2009-10-14 16:10:01 +00:00
|
|
|
*
|
2008-09-19 00:47:49 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2019-08-03 05:10:55 +02:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-09-19 00:47:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
2014-02-19 12:52:14 -05:00
|
|
|
|
2019-10-25 13:13:51 -06:00
|
|
|
#include "evoral/Control.h"
|
|
|
|
|
#include "evoral/ControlList.h"
|
|
|
|
|
#include "evoral/ParameterDescriptor.h"
|
|
|
|
|
#include "evoral/TypeMap.h"
|
2008-09-19 00:47:49 +00:00
|
|
|
|
|
|
|
|
namespace Evoral {
|
|
|
|
|
|
2014-12-01 14:28:03 -05:00
|
|
|
Control::Control(const Parameter& parameter,
|
|
|
|
|
const ParameterDescriptor& desc,
|
2023-02-16 16:33:28 -07:00
|
|
|
std::shared_ptr<ControlList> list)
|
2008-09-21 16:17:02 +00:00
|
|
|
: _parameter(parameter)
|
2017-06-21 13:40:41 +02:00
|
|
|
, _user_value(desc.normal)
|
2008-09-19 00:47:49 +00:00
|
|
|
{
|
2010-07-12 00:41:45 +00:00
|
|
|
set_list (list);
|
2008-09-19 00:47:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2020-09-20 16:34:58 -06:00
|
|
|
Control::set_double (double value, Temporal::timepos_t const & when, bool to_list)
|
2008-09-19 00:47:49 +00:00
|
|
|
{
|
|
|
|
|
_user_value = value;
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2014-02-19 12:52:14 -05:00
|
|
|
/* if we're in a write pass, the automation watcher will determine the
|
|
|
|
|
values and add them to the list, so we we don't need to bother.
|
|
|
|
|
*/
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2014-12-01 19:37:05 -05:00
|
|
|
if (to_list && (!_list->in_write_pass() || _list->descriptor().toggled)) {
|
2020-08-24 14:40:03 -06:00
|
|
|
_list->add (when, value, false);
|
2010-02-07 02:48:07 +00:00
|
|
|
}
|
2008-09-19 00:47:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2023-02-16 16:33:28 -07:00
|
|
|
Control::set_list(std::shared_ptr<ControlList> list)
|
2008-09-19 00:47:49 +00:00
|
|
|
{
|
2010-07-12 00:41:45 +00:00
|
|
|
_list_marked_dirty_connection.disconnect ();
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2008-09-19 00:47:49 +00:00
|
|
|
_list = list;
|
2010-07-12 00:41:45 +00:00
|
|
|
|
|
|
|
|
if (_list) {
|
2024-10-19 01:51:44 +02:00
|
|
|
_list->Dirty.connect_same_thread (_list_marked_dirty_connection, std::bind (&Control::list_marked_dirty, this));
|
2010-07-12 00:41:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Control::list_marked_dirty ()
|
|
|
|
|
{
|
|
|
|
|
ListMarkedDirty (); /* EMIT SIGNAL */
|
2008-09-19 00:47:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Evoral
|
|
|
|
|
|