PBD::Signal1<void, AutoState> automation_state_changed;
bool automation_playback() const {
- return (_state & Play) || ((_state & Touch) && !touching());
+ return (_state & Play) || ((_state & (Touch | Latch)) && !touching());
}
bool automation_write () const {
- return ((_state & Write) || ((_state & Touch) && touching()));
+ return ((_state & Write) || ((_state & (Touch | Latch)) && touching()));
}
PBD::Signal0<void> StateChanged;
void stop_touch (double when);
bool touching() const { return g_atomic_int_get (const_cast<gint*>(&_touching)); }
bool writing() const { return _state == Write; }
- bool touch_enabled() const { return _state == Touch; }
+ bool touch_enabled() const { return _state & (Touch | Latch); }
XMLNode& get_state ();
int set_state (const XMLNode &, int version);
PBD::Signal1<void, AutoState> automation_state_changed;
bool automation_playback() const {
- return (_auto_state & Play) || ((_auto_state & Touch) && !touching());
+ return (_auto_state & Play) || ((_auto_state & (Touch | Latch)) && !touching());
}
bool automation_write () const {
- return ((_auto_state & Write) || ((_auto_state & Touch) && touching()));
+ return ((_auto_state & Write) || ((_auto_state & (Touch | Latch)) && touching()));
}
std::string value_as_string (boost::shared_ptr<const AutomationControl>) const;
void start_touch (double when);
void stop_touch (double when);
- bool touching() const { return g_atomic_int_get (const_cast<gint*>(&_touching)); }
+ bool touching() const { return g_atomic_int_get (const_cast<gint*>(&_touching)); }
bool writing() const { return _auto_state == Write; }
- bool touch_enabled() const { return _auto_state == Touch; }
+ bool touch_enabled() const { return _auto_state & (Touch | Latch); }
XMLNode& get_state ();
XMLNode& state (bool full_state);
};
enum AutoState {
- Off = 0x0,
- Write = 0x1,
- Touch = 0x2,
- Play = 0x4
+ Off = 0x00,
+ Write = 0x01,
+ Touch = 0x02,
+ Play = 0x04,
+ Latch = 0x08
};
std::string auto_state_to_string (AutoState);
case Write:
l->set_automation_state (Off);
break;
+ case Latch:
+ // no break
case Touch:
l->set_automation_state (Play);
break;
*/
const bool list_did_write = !l->in_new_write_pass ();
+ c->stop_touch (now);
l->stop_touch (now);
c->commit_transaction (list_did_write);
if (as == Write) {
AutomationWatch::instance().add_automation_watch (shared_from_this());
- } else if (as == Touch) {
+ } else if (as & (Touch | Latch)) {
if (alist()->empty()) {
Control::set_double (val, _session.current_start_frame (), true);
Control::set_double (val, _session.current_end_frame (), true);
return;
}
- if (alist()->automation_state() == Touch) {
+ if (alist()->automation_state() & (Touch | Latch)) {
/* subtle. aligns the user value with the playback and
* use take actual value (incl masters).
*
return;
}
+ if (alist()->automation_state() == Latch && _session.transport_rolling ()) {
+ return;
+ }
+
set_touching (false);
- if (alist()->automation_state() == Touch) {
+ if (alist()->automation_state() & (Touch | Latch)) {
alist()->stop_touch (when);
if (!_desc.toggled) {
AutomationWatch::instance().remove_automation_watch (shared_from_this());
REGISTER_ENUM (Write);
REGISTER_ENUM (Touch);
REGISTER_ENUM (Play);
+ REGISTER_ENUM (Latch);
REGISTER_BITS (_AutoState);
REGISTER_ENUM (CaptureTime);
.addConst ("Write", ARDOUR::AutoState(Write))
.addConst ("Touch", ARDOUR::AutoState(Touch))
.addConst ("Play", ARDOUR::AutoState(Play))
+ .addConst ("Latch", ARDOUR::AutoState(Latch))
.endNamespace ()
.beginNamespace ("AutomationType")
// If we shouldn't play automation defer to distribute_no_automation
- if (!(as & Play || ((as & Touch) && !_panner->touching()))) {
+ if (!((as & Play) || ((as & (Touch | Latch)) && !_panner->touching()))) {
distribute_no_automation (inbufs, outbufs, nframes, 1.0);
return Write;
} else if (str == X_("Touch")) {
return Touch;
+ } else if (str == X_("Latch")) {
+ return Latch;
}
fatal << string_compose (_("programming error: %1 %2"), "illegal AutoState string: ", str) << endmsg;
break;
case Touch:
return X_("Touch");
+ break;
+ case Latch:
+ return X_("Latch");
+ break;
}
fatal << string_compose (_("programming error: %1 %2"), "illegal AutoState type: ", as) << endmsg;