Fix merging boolean automation + mute disconnect.
This commit is contained in:
parent
07aeb12d3a
commit
5b9822ab98
@ -123,7 +123,7 @@ double
|
||||
MuteControl::get_value () const
|
||||
{
|
||||
if (slaved ()) {
|
||||
return muted_by_self() || get_masters_value ();
|
||||
return muted_by_self() || muted_by_masters ();
|
||||
}
|
||||
|
||||
if (_list && boost::dynamic_pointer_cast<AutomationList>(_list)->automation_playback()) {
|
||||
@ -158,7 +158,7 @@ MuteControl::muted () const
|
||||
Control, or the Muteable that we sort-of proxy for. Since this
|
||||
method is called by ::get_value(), use the latter to avoid recursion.
|
||||
*/
|
||||
return _muteable.mute_master()->muted_by_self() || get_masters_value ();
|
||||
return _muteable.mute_master()->muted_by_self() || muted_by_masters ();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -170,7 +170,7 @@ MuteControl::muted_by_self () const
|
||||
bool
|
||||
MuteControl::muted_by_masters () const
|
||||
{
|
||||
return get_masters_value ();
|
||||
return _muteable.mute_master()->muted_by_masters ();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -184,11 +184,6 @@ MuteControl::automation_run (framepos_t start, pframes_t len)
|
||||
{
|
||||
boolean_automation_run (start, len);
|
||||
|
||||
if (muted_by_masters ()) {
|
||||
// already muted, no need to check further
|
||||
return;
|
||||
}
|
||||
|
||||
bool valid = false;
|
||||
bool mute = false;
|
||||
|
||||
@ -200,6 +195,17 @@ MuteControl::automation_run (framepos_t start, pframes_t len)
|
||||
return;
|
||||
}
|
||||
|
||||
if (muted_by_masters ()) {
|
||||
/* already muted, no need to check further,
|
||||
* except we need to up update implicit/explict mute
|
||||
*/
|
||||
if (muted_by_self () != mute) {
|
||||
set_value_unchecked (mute ? 1. : 0.);
|
||||
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (mute && !muted()) {
|
||||
set_value_unchecked (1.0); // mute
|
||||
Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
|
||||
|
@ -313,7 +313,14 @@ double
|
||||
SlavableAutomationControl::scale_automation_callback (double value, double ratio) const
|
||||
{
|
||||
/* derived classes can override this and e.g. add/subtract. */
|
||||
value *= ratio;
|
||||
if (toggled ()) {
|
||||
// XXX we should use the master's upper/lower as threshold
|
||||
if (ratio >= 0.5 * (upper () - lower ())) {
|
||||
value = upper ();
|
||||
}
|
||||
} else {
|
||||
value *= ratio;
|
||||
}
|
||||
value = std::max (lower(), std::min(upper(), value));
|
||||
return value;
|
||||
}
|
||||
@ -332,7 +339,7 @@ SlavableAutomationControl::remove_master (boost::shared_ptr<AutomationControl> m
|
||||
|
||||
bool update_value = false;
|
||||
double master_ratio = 0;
|
||||
double list_ratio = 1;
|
||||
double list_ratio = toggled () ? 0 : 1;
|
||||
|
||||
boost::shared_ptr<AutomationControl> master;
|
||||
|
||||
@ -366,6 +373,7 @@ SlavableAutomationControl::remove_master (boost::shared_ptr<AutomationControl> m
|
||||
XMLNode* before = &alist ()->get_state ();
|
||||
if (master->automation_playback () && master->list()) {
|
||||
_list->list_merge (*master->list().get(), boost::bind (&SlavableAutomationControl::scale_automation_callback, this, _1, _2));
|
||||
printf ("y-t %s %f\n", name().c_str(), list_ratio);
|
||||
_list->y_transform (boost::bind (&SlavableAutomationControl::scale_automation_callback, this, _1, list_ratio));
|
||||
} else {
|
||||
// do we need to freeze/thaw the list? probably no: iterators & positions don't change
|
||||
@ -399,7 +407,7 @@ SlavableAutomationControl::clear_masters ()
|
||||
ControlList masters;
|
||||
bool update_value = false;
|
||||
double master_ratio = 0;
|
||||
double list_ratio = 1;
|
||||
double list_ratio = toggled () ? 0 : 1;
|
||||
|
||||
/* null ptr means "all masters */
|
||||
pre_remove_master (boost::shared_ptr<AutomationControl>());
|
||||
|
Loading…
Reference in New Issue
Block a user