13
0

change return type of AutomationControl::actually_set_value() from void to bool, to indicate if value was changed.

Don't call Session::set_dirty() when no change occurs
This commit is contained in:
Paul Davis 2016-10-12 17:26:46 -04:00
parent 27cff39dc7
commit c104c9d472
26 changed files with 76 additions and 59 deletions

View File

@ -105,7 +105,7 @@ class LIBARDOUR_API AutomationControl
* this is only used by automation playback.
*/
void set_value_unchecked (double val) {
actually_set_value (val, PBD::Controllable::NoGroup);
(void) actually_set_value (val, PBD::Controllable::NoGroup);
}
double lower() const { return _desc.lower; }
@ -134,7 +134,7 @@ class LIBARDOUR_API AutomationControl
Controllable::Changed signal is emitted when necessary.
*/
virtual void actually_set_value (double value, PBD::Controllable::GroupControlDisposition);
virtual bool actually_set_value (double value, PBD::Controllable::GroupControlDisposition);
/* Session needs to call this method before it queues up the real
change for execution in a realtime context. C++ access control sucks.

View File

@ -95,7 +95,7 @@ public:
MidiTrack* _route;
private:
void actually_set_value (double val, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double val, PBD::Controllable::GroupControlDisposition group_override);
};
virtual void set_parameter_automation_state (Evoral::Parameter param, AutoState);

View File

@ -46,7 +46,7 @@ class LIBARDOUR_API MonitorControl : public SlavableAutomationControl
XMLNode& get_state ();
protected:
void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
private:
Monitorable& _monitorable;

View File

@ -71,7 +71,7 @@ class LIBARDOUR_API MuteControl : public SlavableAutomationControl
protected:
void master_changed (bool, PBD::Controllable::GroupControlDisposition, boost::shared_ptr<AutomationControl>);
void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
void pre_remove_master (boost::shared_ptr<AutomationControl>);
void post_add_master (boost::shared_ptr<AutomationControl>);

View File

@ -51,7 +51,7 @@ class LIBARDOUR_API PanControllable : public AutomationControl
private:
Pannable* owner;
void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
};
} // namespace

View File

@ -60,7 +60,7 @@ class LIBARDOUR_API PhaseControl : public AutomationControl
XMLNode& get_state ();
protected:
void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
private:
boost::dynamic_bitset<> _phase_invert;

View File

@ -198,7 +198,7 @@ class LIBARDOUR_API PluginInsert : public Processor
private:
PluginInsert* _plugin;
void actually_set_value (double val, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double val, PBD::Controllable::GroupControlDisposition group_override);
};
/** A control that manipulates a plugin property (message). */
@ -212,7 +212,7 @@ class LIBARDOUR_API PluginInsert : public Processor
double get_value (void) const;
XMLNode& get_state();
protected:
void actually_set_value (double value, PBD::Controllable::GroupControlDisposition);
bool actually_set_value (double value, PBD::Controllable::GroupControlDisposition);
private:
PluginInsert* _plugin;

View File

@ -49,7 +49,7 @@ class LIBARDOUR_API RecordEnableControl : public SlavableAutomationControl
void set_value (double, PBD::Controllable::GroupControlDisposition);
protected:
void actually_set_value (double val, Controllable::GroupControlDisposition gcd);
bool actually_set_value (double val, Controllable::GroupControlDisposition gcd);
void do_pre_realtime_queue_stuff (double value);
private:

View File

@ -39,7 +39,7 @@ class LIBARDOUR_API RecordSafeControl : public SlavableAutomationControl
~RecordSafeControl() {}
protected:
void actually_set_value (double val, Controllable::GroupControlDisposition gcd);
bool actually_set_value (double val, Controllable::GroupControlDisposition gcd);
private:
Recordable& _recordable;

View File

@ -102,7 +102,7 @@ class LIBARDOUR_API SlavableAutomationControl : public AutomationControl
void master_going_away (boost::weak_ptr<AutomationControl>);
double get_value_locked() const;
void actually_set_value (double val, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double val, PBD::Controllable::GroupControlDisposition group_override);
void update_boolean_masters_records (boost::shared_ptr<AutomationControl>);
virtual void master_changed (bool from_self, GroupControlDisposition gcd, boost::shared_ptr<AutomationControl>);

View File

@ -96,7 +96,7 @@ class LIBARDOUR_API SoloControl : public SlavableAutomationControl
XMLNode& get_state ();
protected:
void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
void master_changed (bool from_self, GroupControlDisposition, boost::shared_ptr<AutomationControl> m);
void pre_remove_master (boost::shared_ptr<AutomationControl>);
void post_add_master (boost::shared_ptr<AutomationControl>);

View File

@ -74,7 +74,7 @@ class LIBARDOUR_API SoloIsolateControl : public SlavableAutomationControl
protected:
void master_changed (bool from_self, PBD::Controllable::GroupControlDisposition gcd, boost::shared_ptr<AutomationControl>);
void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
private:
Soloable& _soloable;

View File

@ -44,7 +44,7 @@ class LIBARDOUR_API SoloSafeControl : public SlavableAutomationControl
XMLNode& get_state ();
protected:
void actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
bool actually_set_value (double, PBD::Controllable::GroupControlDisposition group_override);
private:
bool _solo_safe;

View File

@ -116,11 +116,11 @@ AutomationControl::set_value (double val, PBD::Controllable::GroupControlDisposi
* (e.g. record if necessary, etc.)
* @param value `user' value
*/
void
bool
AutomationControl::actually_set_value (double value, PBD::Controllable::GroupControlDisposition gcd)
{
bool to_list = _list && boost::dynamic_pointer_cast<AutomationList>(_list)->automation_write();
//const double old_value = Control::user_double ();
const double old_value = get_value ();
Control::set_double (value, _session.transport_frame(), to_list);
@ -128,7 +128,12 @@ AutomationControl::actually_set_value (double value, PBD::Controllable::GroupCon
//std::cerr << "++++ Changed (" << enum_2_string (at) << ", " << enum_2_string (gcd) << ") = " << value
//<< " (was " << old_value << ") @ " << this << std::endl;
Changed (true, gcd);
if (old_value != value) {
Changed (true, gcd);
return true;
}
return false;
}
void

View File

@ -712,7 +712,7 @@ MidiTrack::set_parameter_automation_state (Evoral::Parameter param, AutoState st
}
}
void
bool
MidiTrack::MidiControl::actually_set_value (double val, PBD::Controllable::GroupControlDisposition group_override)
{
const Evoral::Parameter &parameter = _list ? _list->parameter() : Control::parameter();
@ -732,7 +732,7 @@ MidiTrack::MidiControl::actually_set_value (double val, PBD::Controllable::Group
}
if (!valid) {
return;
return false;
}
assert(val <= desc.upper);
@ -776,7 +776,7 @@ MidiTrack::MidiControl::actually_set_value (double val, PBD::Controllable::Group
_route->write_immediate_event(size, ev);
}
AutomationControl::actually_set_value(val, group_override);
return AutomationControl::actually_set_value(val, group_override);
}
void

View File

@ -36,7 +36,7 @@ MonitorControl::MonitorControl (Session& session, std::string const & name, Moni
set_flags (Controllable::Flag (flags() | Controllable::RealTime));
}
void
bool
MonitorControl::actually_set_value (double val, Controllable::GroupControlDisposition gcd)
{
int v = (int) val;
@ -48,11 +48,11 @@ MonitorControl::actually_set_value (double val, Controllable::GroupControlDispos
break;
default:
/* illegal value */
return;
return false;
}
_monitoring = MonitorChoice (v);
AutomationControl::actually_set_value (val, gcd);
return AutomationControl::actually_set_value (val, gcd);
}
XMLNode&

View File

@ -74,7 +74,7 @@ MuteControl::pre_remove_master (boost::shared_ptr<AutomationControl> m)
}
}
void
bool
MuteControl::actually_set_value (double val, Controllable::GroupControlDisposition gcd)
{
if (muted_by_self() != bool (val)) {
@ -86,7 +86,7 @@ MuteControl::actually_set_value (double val, Controllable::GroupControlDispositi
_muteable.act_on_mute ();
}
SlavableAutomationControl::actually_set_value (val, gcd);
return SlavableAutomationControl::actually_set_value (val, gcd);
}
void

View File

@ -34,15 +34,14 @@ PanControllable::lower () const
}
}
void
bool
PanControllable::actually_set_value (double v, Controllable::GroupControlDisposition group_override)
{
boost::shared_ptr<Panner> p = owner->panner();
if (!p) {
/* no panner: just do it */
AutomationControl::actually_set_value (v, group_override);
return;
return AutomationControl::actually_set_value (v, group_override);
}
bool can_set = false;
@ -62,8 +61,10 @@ PanControllable::actually_set_value (double v, Controllable::GroupControlDisposi
}
if (can_set) {
AutomationControl::actually_set_value (v, group_override);
return AutomationControl::actually_set_value (v, group_override);
}
return false;
}
std::string

View File

@ -32,12 +32,12 @@ PhaseControl::PhaseControl (Session& session, std::string const & name)
{
}
void
bool
PhaseControl::actually_set_value (double val, Controllable::GroupControlDisposition gcd)
{
_phase_invert = boost::dynamic_bitset<> (std::numeric_limits<double>::digits, (unsigned long) val);
AutomationControl::actually_set_value (val, gcd);
return AutomationControl::actually_set_value (val, gcd);
}
/** @param c Audio channel index.
@ -48,7 +48,7 @@ PhaseControl::set_phase_invert (uint32_t c, bool yn)
{
if (_phase_invert[c] != yn) {
_phase_invert[c] = yn;
AutomationControl::actually_set_value (_phase_invert.to_ulong(), Controllable::NoGroup);
(void) AutomationControl::actually_set_value (_phase_invert.to_ulong(), Controllable::NoGroup);
_session.set_dirty ();
}
}
@ -58,7 +58,7 @@ PhaseControl::set_phase_invert (boost::dynamic_bitset<> p)
{
if (_phase_invert != p) {
_phase_invert = p;
AutomationControl::actually_set_value (_phase_invert.to_ulong(), Controllable::NoGroup);
(void) AutomationControl::actually_set_value (_phase_invert.to_ulong(), Controllable::NoGroup);
Changed (true, Controllable::NoGroup); /* EMIT SIGNAL */
_session.set_dirty ();
}

View File

@ -2767,7 +2767,7 @@ PluginInsert::PluginControl::PluginControl (PluginInsert* p,
/** @param val `user' value */
void
bool
PluginInsert::PluginControl::actually_set_value (double user_val, PBD::Controllable::GroupControlDisposition group_override)
{
/* FIXME: probably should be taking out some lock here.. */
@ -2781,13 +2781,13 @@ PluginInsert::PluginControl::actually_set_value (double user_val, PBD::Controlla
iasp->set_parameter (_list->parameter().id(), user_val);
}
AutomationControl::actually_set_value (user_val, group_override);
return AutomationControl::actually_set_value (user_val, group_override);
}
void
PluginInsert::PluginControl::catch_up_with_external_value (double user_val)
{
AutomationControl::actually_set_value (user_val, Controllable::NoGroup);
(void) AutomationControl::actually_set_value (user_val, Controllable::NoGroup);
}
XMLNode&
@ -2834,7 +2834,7 @@ PluginInsert::PluginPropertyControl::PluginPropertyControl (PluginInsert*
}
}
void
bool
PluginInsert::PluginPropertyControl::actually_set_value (double user_val, Controllable::GroupControlDisposition gcd)
{
/* Old numeric set_value(), coerce to appropriate datatype if possible.
@ -2843,7 +2843,7 @@ PluginInsert::PluginPropertyControl::actually_set_value (double user_val, Contro
const Variant value(_desc.datatype, user_val);
if (value.type() == Variant::NOTHING) {
error << "set_value(double) called for non-numeric property" << endmsg;
return;
return false;
}
for (Plugins::iterator i = _plugin->_plugins.begin(); i != _plugin->_plugins.end(); ++i) {
@ -2852,7 +2852,7 @@ PluginInsert::PluginPropertyControl::actually_set_value (double user_val, Contro
_value = value;
AutomationControl::actually_set_value (user_val, gcd);
return AutomationControl::actually_set_value (user_val, gcd);
}
XMLNode&

View File

@ -45,15 +45,15 @@ RecordEnableControl::set_value (double val, Controllable::GroupControlDispositio
SlavableAutomationControl::set_value (val, gcd);
}
void
bool
RecordEnableControl::actually_set_value (double val, Controllable::GroupControlDisposition gcd)
{
if (val && !_recordable.can_be_record_enabled()) {
std::cerr << "rec-enable not allowed\n";
return;
return false;
}
SlavableAutomationControl::actually_set_value (val, gcd);
return SlavableAutomationControl::actually_set_value (val, gcd);
}
void

View File

@ -36,14 +36,14 @@ RecordSafeControl::RecordSafeControl (Session& session, std::string const & name
set_flags (Controllable::Flag (flags() | Controllable::RealTime));
}
void
bool
RecordSafeControl::actually_set_value (double val, Controllable::GroupControlDisposition gcd)
{
if (val && !_recordable.can_be_record_safe()) {
std::cerr << "rec-enable not allowed\n";
return;
return false;
}
SlavableAutomationControl::actually_set_value (val, gcd);
return SlavableAutomationControl::actually_set_value (val, gcd);
}

View File

@ -96,7 +96,7 @@ SlavableAutomationControl::get_value() const
}
}
void
bool
SlavableAutomationControl::actually_set_value (double val, Controllable::GroupControlDisposition group_override)
{
val = std::max (std::min (val, (double)_desc.upper), (double)_desc.lower);
@ -112,9 +112,12 @@ SlavableAutomationControl::actually_set_value (double val, Controllable::GroupCo
/* this sets the Evoral::Control::_user_value for us, which will
be retrieved by AutomationControl::get_value ()
*/
AutomationControl::actually_set_value (val, group_override);
if (AutomationControl::actually_set_value (val, group_override)) {
_session.set_dirty ();
return true;
}
_session.set_dirty ();
return false;
}
void

View File

@ -157,11 +157,11 @@ SoloControl::mod_solo_by_others_upstream (int32_t delta)
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
}
void
bool
SoloControl::actually_set_value (double val, PBD::Controllable::GroupControlDisposition group_override)
{
if (_soloable.is_safe() || !_soloable.can_solo()) {
return;
return false;
}
set_self_solo (val == 1.0);
@ -170,7 +170,7 @@ SoloControl::actually_set_value (double val, PBD::Controllable::GroupControlDisp
be retrieved by AutomationControl::get_value (), and emits Changed
*/
SlavableAutomationControl::actually_set_value (val, group_override);
return SlavableAutomationControl::actually_set_value (val, group_override);
}
double

View File

@ -88,11 +88,11 @@ SoloIsolateControl::mod_solo_isolated_by_upstream (int32_t delta)
}
}
void
bool
SoloIsolateControl::actually_set_value (double val, PBD::Controllable::GroupControlDisposition gcd)
{
if (!_soloable.can_solo()) {
return;
return false;
}
set_solo_isolated (val, gcd);
@ -101,8 +101,12 @@ SoloIsolateControl::actually_set_value (double val, PBD::Controllable::GroupCont
be retrieved by AutomationControl::get_value (), and emits Changed
*/
AutomationControl::actually_set_value (val, gcd);
_session.set_dirty ();
if (AutomationControl::actually_set_value (val, gcd)) {
_session.set_dirty ();
return true;
}
return false;
}
void

View File

@ -36,7 +36,7 @@ SoloSafeControl::SoloSafeControl (Session& session, std::string const & name)
_list->set_interpolation(Evoral::ControlList::Discrete);
}
void
bool
SoloSafeControl::actually_set_value (double val, PBD::Controllable::GroupControlDisposition gcd)
{
_solo_safe = (val ? true : false);
@ -45,8 +45,12 @@ SoloSafeControl::actually_set_value (double val, PBD::Controllable::GroupControl
be retrieved by AutomationControl::get_value (), and emits Changed
*/
AutomationControl::actually_set_value (val, gcd);
_session.set_dirty ();
if (AutomationControl::actually_set_value (val, gcd)) {
_session.set_dirty ();
return true;
}
return false;
}
double