2016-05-27 16:11:22 -04:00
|
|
|
/*
|
2019-08-02 22:01:25 -04:00
|
|
|
* Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2016-05-27 16:11:22 -04:00
|
|
|
|
|
|
|
#include "ardour/audioengine.h"
|
|
|
|
#include "ardour/record_safe_control.h"
|
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2016-05-27 16:11:22 -04:00
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
|
|
|
|
2023-07-21 11:56:42 -04:00
|
|
|
RecordSafeControl::RecordSafeControl (Session& session, std::string const & name, Recordable& r, Temporal::TimeDomainProvider const & tdp)
|
2016-05-27 16:11:22 -04:00
|
|
|
: SlavableAutomationControl (session, RecSafeAutomation, ParameterDescriptor (RecSafeAutomation),
|
2023-07-21 11:56:42 -04:00
|
|
|
std::shared_ptr<AutomationList>(new AutomationList(Evoral::Parameter(RecSafeAutomation), tdp)),
|
2016-05-27 16:11:22 -04:00
|
|
|
name)
|
|
|
|
, _recordable (r)
|
|
|
|
{
|
|
|
|
_list->set_interpolation(Evoral::ControlList::Discrete);
|
|
|
|
|
|
|
|
/* record-enable changes must be synchronized by the process cycle */
|
2020-03-10 15:19:14 -04:00
|
|
|
set_flag (Controllable::RealTime);
|
2016-05-27 16:11:22 -04:00
|
|
|
}
|
|
|
|
|
2016-10-14 11:16:42 -04:00
|
|
|
void
|
2016-05-27 16:11:22 -04:00
|
|
|
RecordSafeControl::actually_set_value (double val, Controllable::GroupControlDisposition gcd)
|
|
|
|
{
|
|
|
|
if (val && !_recordable.can_be_record_safe()) {
|
|
|
|
std::cerr << "rec-enable not allowed\n";
|
2016-10-14 11:16:42 -04:00
|
|
|
return;
|
2016-05-27 16:11:22 -04:00
|
|
|
}
|
|
|
|
|
2016-10-14 11:16:42 -04:00
|
|
|
SlavableAutomationControl::actually_set_value (val, gcd);
|
2016-05-27 16:11:22 -04:00
|
|
|
}
|
|
|
|
|