Fix touching mute automation (mostly)
controllable->set_value() from GUI context will eventually queue a session-rt command. By the time the realtime command runs, the controllable needs to be in "touch" mode. The AutomationController "toggle" UI worked around this by directly using the underlying API (ignoring slaved-controls and ignoring groups). The RouteUI's GUI wasn't able to write mute-automation at all. This commit is a compromise: press + hold (touch) + release button. (it may need further special-casing for _desc.toggled in AutomationControl::actually_set_value(), also undoing automation-writes is currently not working correctly)
This commit is contained in:
parent
1071c0e788
commit
5c4a2025f1
|
@ -87,9 +87,12 @@ AutomationController::AutomationController(boost::shared_ptr<Automatable>
|
|||
} else {
|
||||
but->set_name("generic button");
|
||||
}
|
||||
but->set_fallthrough_to_parent(true);
|
||||
but->set_controllable(ac);
|
||||
but->signal_clicked.connect(
|
||||
sigc::mem_fun(*this, &AutomationController::toggled));
|
||||
but->signal_button_press_event().connect(
|
||||
sigc::mem_fun(*this, &AutomationController::button_press));
|
||||
but->signal_button_release_event().connect(
|
||||
sigc::mem_fun(*this, &AutomationController::button_release));
|
||||
const bool active = _adjustment->get_value() >= 0.5;
|
||||
if (but->get_active() != active) {
|
||||
but->set_active(active);
|
||||
|
@ -161,6 +164,7 @@ AutomationController::display_effective_value()
|
|||
_adjustment->set_value (interface_value);
|
||||
_ignore_change = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -206,33 +210,22 @@ AutomationController::end_touch ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
AutomationController::toggled ()
|
||||
bool
|
||||
AutomationController::button_press (GdkEventButton*)
|
||||
{
|
||||
ArdourButton* but = dynamic_cast<ArdourButton*>(_widget);
|
||||
const AutoState as = _controllable->automation_state ();
|
||||
const double where = _controllable->session ().audible_frame ();
|
||||
const bool to_list = _controllable->list () && _controllable->session().transport_rolling () && (as == Touch || as == Write);
|
||||
|
||||
if (but) {
|
||||
if (to_list) {
|
||||
if (as == Touch && _controllable->list ()->in_new_write_pass ()) {
|
||||
_controllable->alist ()->start_write_pass (where);
|
||||
}
|
||||
_controllable->list ()->set_in_write_pass (true, false, where);
|
||||
}
|
||||
/* set to opposite value.*/
|
||||
_controllable->set_double (but->get_active () ? 0.0 : 1.0, where, to_list);
|
||||
|
||||
const bool active = _controllable->get_double (to_list, where) >= 0.5;
|
||||
if (active && !but->get_active ()) {
|
||||
_adjustment->set_value (1.0);
|
||||
but->set_active (true);
|
||||
} else if (!active && but->get_active ()) {
|
||||
_adjustment->set_value (0.0);
|
||||
but->set_active (false);
|
||||
}
|
||||
start_touch ();
|
||||
_controllable->set_value (but->get_active () ? 0.0 : 1.0, Controllable::UseGroup);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
AutomationController::button_release (GdkEventButton*)
|
||||
{
|
||||
end_touch ();
|
||||
return false;
|
||||
}
|
||||
|
||||
static double
|
||||
|
|
|
@ -86,7 +86,8 @@ private:
|
|||
|
||||
void start_touch();
|
||||
void end_touch();
|
||||
void toggled();
|
||||
bool button_press(GdkEventButton*);
|
||||
bool button_release(GdkEventButton*);
|
||||
|
||||
void run_note_select_dialog();
|
||||
void set_ratio(double ratio);
|
||||
|
|
|
@ -492,6 +492,8 @@ RouteUI::mute_press (GdkEventButton* ev)
|
|||
_mute_release->routes = rl;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MuteControl> mc = _route->mute_control();
|
||||
mc->start_touch (_session->audible_frame ());
|
||||
_session->set_controls (route_list_to_control_list (rl, &Stripable::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::InverseGroup);
|
||||
}
|
||||
|
||||
|
@ -506,7 +508,9 @@ RouteUI::mute_press (GdkEventButton* ev)
|
|||
_mute_release->routes = rl;
|
||||
}
|
||||
|
||||
_route->mute_control()->set_value (!_route->muted_by_self(), Controllable::UseGroup);
|
||||
boost::shared_ptr<MuteControl> mc = _route->mute_control();
|
||||
mc->start_touch (_session->audible_frame ());
|
||||
mc->set_value (!_route->muted_by_self(), Controllable::UseGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -523,6 +527,8 @@ RouteUI::mute_release (GdkEventButton* /*ev*/)
|
|||
_mute_release = 0;
|
||||
}
|
||||
|
||||
_route->mute_control()->stop_touch (false, _session->audible_frame ());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue