13
0

Automation - more toggled controller twiddling.

This commit is contained in:
nick_m 2015-10-03 05:08:26 +10:00
parent 1648000108
commit ffed94d89b
3 changed files with 32 additions and 32 deletions

View File

@ -197,28 +197,26 @@ AutomationController::toggled ()
{ {
ArdourButton* but = dynamic_cast<ArdourButton*>(_widget); ArdourButton* but = dynamic_cast<ArdourButton*>(_widget);
const AutoState as = _controllable->automation_state (); 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); const bool to_list = _controllable->list () && _controllable->session().transport_rolling () && (as == Touch || as == Write);
if (but) { if (but) {
if (_controllable->session().transport_rolling()) { if (to_list) {
if (_controllable->automation_state() == Touch && _controllable->list()->in_new_write_pass ()) { if (as == Touch && _controllable->list ()->in_new_write_pass ()) {
_controllable->alist()->start_write_pass ( _controllable->session().audible_frame()); _controllable->alist ()->start_write_pass (where);
}
if (_controllable->list()) {
_controllable->list()->set_in_write_pass(true, false, _controllable->session().audible_frame());
} }
_controllable->list ()->set_in_write_pass (true, false, where);
} }
_controllable->set_double (!but->get_active (), _controllable->session ().transport_frame (), to_list); _controllable->set_double (!but->get_active (), where, to_list);
const bool was_active = _controllable->get_value() >= 0.5; const bool active = _controllable->get_double (to_list, where) >= 0.5;
if (was_active && but->get_active()) { if (active && !but->get_active ()) {
_adjustment->set_value(0.0); _adjustment->set_value (1.0);
but->set_active(false); but->set_active (true);
} else if (!was_active && !but->get_active()) { } else if (!active && but->get_active ()) {
_adjustment->set_value(1.0); _adjustment->set_value (0.0);
but->set_active(true); but->set_active (false);
} }
} }
} }

View File

@ -397,17 +397,19 @@ Automatable::transport_stopped (framepos_t now)
const bool list_did_write = !l->in_new_write_pass (); const bool list_did_write = !l->in_new_write_pass ();
l->stop_touch (true, now); l->stop_touch (true, now);
if (list_did_write) { if (list_did_write) {
c->commit_transaction (); c->commit_transaction ();
} }
l->write_pass_finished (now, Config->get_automation_thinning_factor());
if (l->automation_state() == Write) { l->write_pass_finished (now, Config->get_automation_thinning_factor ());
if (l->automation_state () == Write) {
l->set_automation_state (Touch); l->set_automation_state (Touch);
} }
if (l->automation_playback()) { if (l->automation_playback ()) {
c->set_value(c->list()->eval(now)); c->set_value (c->list ()->eval (now));
} }
} }
} }

View File

@ -3900,22 +3900,22 @@ Route::MuteControllable::set_superficial_value(bool muted)
/* Note we can not use AutomationControl::set_value here since it will emit /* Note we can not use AutomationControl::set_value here since it will emit
Changed(), but the value will not be correct to the observer. */ Changed(), but the value will not be correct to the observer. */
/* this is a tweak of ControlList::automation_write () const bool to_list = _list && ((AutomationList*)_list.get ())->automation_write ();
as currently MuteControllable can't be touching. const double where = _session.audible_frame ();
bool to_list = _list && ((AutomationList*)_list.get())->automation_write();
*/
AutomationList* alist = (AutomationList*)_list.get();
const AutoState as = alist->automation_state ();
const bool to_list = _list && _session.transport_rolling () && (as == Touch || as == Write);
if (to_list) { if (to_list) {
if (as == Touch && _list->in_new_write_pass ()) { /* Note that we really need this:
alist->start_write_pass (_session.audible_frame ()); * if (as == Touch && _list->in_new_write_pass ()) {
} * alist->start_write_pass (_session.audible_frame ());
_list->set_in_write_pass (true, false, _session.audible_frame ()); * }
* here in the case of the user calling from a GUI or whatever.
* Without the ability to distinguish between user and
* automation-initiated changes, we lose the "touch mute"
* behaviour we have in AutomationController::toggled ().
*/
_list->set_in_write_pass (true, false, where);
} }
Control::set_double (muted, _session.transport_frame(), to_list); Control::set_double (muted, where, to_list);
} }
void void