Fix write for boolean automation.

This commit is contained in:
David Robillard 2014-11-29 14:32:12 -05:00
parent c77f4b7a18
commit 77d5fb7a35
2 changed files with 11 additions and 15 deletions

View file

@ -162,12 +162,15 @@ AutomationController::value_adjusted ()
{ {
if (!_ignore_change) { if (!_ignore_change) {
_controllable->set_value (_controllable->interface_to_internal(_adjustment->get_value())); _controllable->set_value (_controllable->interface_to_internal(_adjustment->get_value()));
} else { }
/* A bar controller will automatically follow the adjustment, but for a
button we have to do it manually. */ /* A bar controller will automatically follow the adjustment, but for a
ArdourButton* but = dynamic_cast<ArdourButton*>(_widget); button we have to do it manually. */
if (but) { ArdourButton* but = dynamic_cast<ArdourButton*>(_widget);
but->set_active(_adjustment->get_value() >= 0.5); if (but) {
const bool active = _adjustment->get_value() >= 0.5;
if (but->get_active() != active) {
but->set_active(active);
} }
} }
} }
@ -202,6 +205,7 @@ AutomationController::toggled ()
{ {
ArdourButton* but = dynamic_cast<ArdourButton*>(_widget); ArdourButton* but = dynamic_cast<ArdourButton*>(_widget);
if (but) { if (but) {
start_touch();
const bool was_active = _controllable->get_value() >= 0.5; const bool was_active = _controllable->get_value() >= 0.5;
if (was_active) { if (was_active) {
_adjustment->set_value(0.0); _adjustment->set_value(0.0);
@ -210,6 +214,7 @@ AutomationController::toggled ()
_adjustment->set_value(1.0); _adjustment->set_value(1.0);
but->set_active(true); but->set_active(true);
} }
end_touch();
} }
} }

View file

@ -62,15 +62,6 @@ AutomationControl::set_value (double value)
{ {
bool to_list = _list && ((AutomationList*)_list.get())->automation_write(); bool to_list = _list && ((AutomationList*)_list.get())->automation_write();
if (to_list && parameter().toggled()) {
// store the previous value just before this so any
// interpolation works right
_list->add (get_double(), _session.transport_frame()-1);
}
Control::set_double (value, _session.transport_frame(), to_list); Control::set_double (value, _session.transport_frame(), to_list);
Changed(); /* EMIT SIGNAL */ Changed(); /* EMIT SIGNAL */